日期:2014-05-17  浏览次数:20502 次

ASPxGridView的GridViewDataColumn组件中EditItemTemplate中组件
前台代码

...
<dxwgv:GridViewDataColumn FieldName="PictureUpload" VisibleIndex="13"   Visible="False" Caption ="图片">
    <EditItemTemplate>
        <dxuc:ASPxUploadControl ID="uplImage" runat="server" ClientInstanceName="uplImage" Size="35"    OnFileUploadComplete="uplImage_FileUploadComplete">
        </dxuc:ASPxUploadControl>
    </EditItemTemplate>
    <EditFormSettings VisibleIndex="13"  Visible="True"/>
    <EditFormCaptionStyle Wrap="False">
    </EditFormCaptionStyle>
</dxwgv:GridViewDataColumn>
...

后台代码

 protected void ASPxGridDetail_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e)
    {

        bool isEdit = ASPxGridDetail.IsEditing;
        //ASPxUploadControl f = (ASPxUploadControl)ASPxGridDetail.TemplateControl.FindControl("uplImage");
        //ASPxUploadControl file = (ASPxUploadControl)(ASPxGridDetail.Columns["PictureUpload"].Grid.TemplateControl.FindControl("uplImage"));
        //ASPxUploadControl f = (ASPxUploadControl)this.ASPxGridDetail.TemplateControl.FindControl("uplImage");
        //GridViewDataColumn gird = (GridViewDataColumn)ASPxGridDetail.Columns["PictureUpload"] ;
        //foreach (TemplateControl ctrl in gird.Grid.TemplateControl)
        //{
        //    string ctrlName = ctrl.ToString();
        //}
        //ASPxUploadControl f = (ASPxUploadControl)ASPxGridDetail.FindEditRowCellTemplateControl(gird , "uplImage");

        string filename = f.FileName;
        string UpdateLog = "Id=" + e.Keys["Id"].ToString();
        DataAccess.SystemLog.InsertLogInfo(LoggingType.Update, "库存管理", "仓库类型维护", UpdateLog);
    }



小弟想在后台取到前台 ID为uplImage 的ASPxUploadControl 控件用了多种方法都取不到,不知道是什么原因.
查了很多帖子都找不到啊....有大神帮忙么?~

------解决方案--------------------

ASPxUploadControl f=((ASPxTextBox)this.ASPxGridView_ID.FindRowCellTemplateControl(0, this.ASPxGridView_ID.Columns["PictureUpload"] as GridViewDataColumn, "uplImage"));

ASPxGridView_ID为dxwgv:ASPxGridView ID="ASPxGridView_ID"