如何在ASPxGridView中获取EditTemplateItem
本文关键字:获取 EditTemplateItem ASPxGridView | 更新日期: 2023-09-27 18:24:04
我在ASPxGridView
中的EditItemTemplate
内部使用ASPxUploadControl
。当我单击编辑行按钮时,会显示ASPxUploadControl
,如果不处于编辑模式,它将充当超链接列并显示下载文件选项。我面临的问题是,在ASPxGridView
的插入和更新事件中,我没有得到控制对象。
我正在做类似的事情
ASPxUploadControl = grid.FindEditRowCellTemplate(grid.Columns[0] as GridViewDataColumn, "upload_control_id") as ASPxUploadControl;
我也试过grid.FindControl()
函数。
尝试此项进行编辑参考此
protected void ASPxUploadControl1_FilesUploadComplete(object sender, DevExpress.Web.ASPxUploadControl.FilesUploadCompleteEventArgs e){
// Intentionally pauses server-side processing to demonstrate the Loading Panel or Progress Panel functionality
System.Threading.Thread.Sleep(2000);
ASPxUploadControl uploadControl = sender as ASPxUploadControl;
if (uploadControl.UploadedFiles != null && uploadControl.UploadedFiles.Length > 0){
for (int i = 0; i < uploadControl.UploadedFiles.Length; i++){
UploadedFile file = uploadControl.UploadedFiles[i];
if (file.FileName != ""){
string fileName = string.Format("{0}{1}", MapPath("~/Images/"), file.FileName);
//file.SaveAs(fileName, true);//OnLine Demo Restriction
}
}
}
}
在Update或Insert事件中,获取GridView以查找get-it的模板控件。
ASPxGridView gridView = sender as ASPxGridView;
ASPxUploadControl control = gridView.FindEditRowCellTemplateControl(gridView.Columns[0] as GridViewDataColumn, "upload_control_id") as ASPxUploadControl;
参考文献:
查找控件更新edititemtemplate
ASPxGridView-如何在EditItemTemplate中找到控件
ASPxGridView-如何在EditItemTemplate中查找控件
如何在AspXGridView';s EditItemTemplate
ASPxGridView查找控件(复选框)并检查是否选中
示例代码片段:
Protected Sub grid_RowInserting(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxDataInsertingEventArgs) Handles grdProyectos.RowInserting
Dim grid As ASPxGridView = (TryCast(sender, ASPxGridView))
Dim chk As CheckBox= grid.FindEditRowCellTemplateControl(grid.Columns("name_colum"), "nameCheckBox")
Dim marcada as Boolean = chk.Checked
End Sub