Skip to content

DevExpress-Examples/asp-net-web-forms-grid-hide-edit-form-editor-programmatically

Repository files navigation

Grid View for ASP.NET Web Forms - How to hide the EditForm editor and column caption programmatically

In this example, the edit form hides an editor for the Description column if the current row's category name meets certain conditions.

GridView edit form

Implementation Details

Specify the EditFormSettings.Visible property value in the BeforeGetCallbackResult event handler to change an editor's visibility.

private string[] values = new string[] { "CategoryName1", "CategoryName3", "CategoryName5", "CategoryName7" };
//...
protected void gv_BeforeGetCallbackResult(object sender, EventArgs e) {
    HideEditor(sender as ASPxGridView);
}

private void HideEditor(ASPxGridView gv) {
    if (gv.IsEditing && !gv.IsNewRowEditing) {
        string value = gv.GetRowValues(gv.EditingRowVisibleIndex, "CategoryName").ToString();
        gv.DataColumns["Description"].EditFormSettings.Visible = values.Contains(value) ? DefaultBoolean.False : DefaultBoolean.True;
    }
}

Files to Look At

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Hide an editor for a column based on certain conditions.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •