Event that is triggered when New is clicked in the Devexpress grid view
The below piece of code enables us to initialize added rows.
ASPxGridView grid= new ASPxGridView();
grid.InitNewRow += new DevExpress.Web.Data.ASPxDataInitNewRowEventHandler(grid_RowInserting);
You can then Call the grid_RowInserting ..So on clicking on the New Link in the Grid, the control is passed on to this function.
Here i have tried to make the columns 2,3 as readonly and column 6 visibility as false
void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
{
((GridViewDataColumn)grid.Columns[2]).ReadOnly = true;
((GridViewDataColumn) grid.Columns[3]).ReadOnly = true;
((GridViewDataColumn) grid.Columns[6]).EditFormSettings.Visible = DevExpress.Web.ASPxClasses.DefaultBoolean.False;
}
ASPxGridView grid= new ASPxGridView();
grid.InitNewRow += new DevExpress.Web.Data.ASPxDataInitNewRowEventHandler(grid_RowInserting);
You can then Call the grid_RowInserting ..So on clicking on the New Link in the Grid, the control is passed on to this function.
Here i have tried to make the columns 2,3 as readonly and column 6 visibility as false
void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
{
((GridViewDataColumn)grid.Columns[2]).ReadOnly = true;
((GridViewDataColumn) grid.Columns[3]).ReadOnly = true;
((GridViewDataColumn) grid.Columns[6]).EditFormSettings.Visible = DevExpress.Web.ASPxClasses.DefaultBoolean.False;
}
Labels: ASPxDataInitNewRowEventHandler, Devexpress Grid, GridViewDataColumn, how to hide columns when New is clicked in Grid, InitNewRow, New, Server events on clicking the New button in the grid