Grid for ASP.NET Web Forms - How to initialize an Edit Form editor based on a value of another column
This example demonstrates how to initialize an editor in grid edit form conditionally based on a value of another column.
Follow the steps below to implement this functionality:
- Create a custom class that implements the
ITemplateinterface. - Call the ASPxGridView.GetRowValues method to get current row values.
- Create an editor conditionally based on the obtained row values.
- Assign the custom template class to the GridViewDataColumn.EditItemTemplate or GridViewTemplates.EditForm property.
- To save modified data, handle the RowUpdating event. In the event handler, call the FindEditFormTemplateControl or FindEditRowCellTemplateControl method to obtain a custom editor. Assign editor's value to the corresponding item in the NewValues dictionary.
- Handle the CustomColumnDisplayText event to specify text that is displayed in the grid.
- CustomEditForm.aspx
- CustomEditForm.aspx.cs
- CustomEditItem.aspx
- CustomEditItem.aspx.cs
- CustomEditFormTemplate.cs
- CustomEditItemTemplate.cs
(you will be redirected to DevExpress.com to submit your response)
