Thursday, October 22, 2009

Edit Forms New Button and Delete Button Events in ASPXGridView

How to Pass the values of the columns for saving in Edit button New Button click event.
This event is triggerd w.r.t GvAddrow() of the Grid.

Create the event InitNewRow of Gridview.
gridview.InitNewRow+=new DevExpress.Web.Data.ASPxDataInitNewRowEventHandler(gridview_InitNewRow);

protected void gridview_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
{
e.NewValues["Name"] = "";
e.NewValues["DOB"] = new DateTime(2009, 1, 10);
e.NewValues["Active"] = "";

}

Similar to Insert, items in Grid view in Edit form for Delete Button.

gridview.RowDeleting += new DevExpress.Web.Data.ASPxDataDeletingEventHandler(gridview_RowDeleting);


void gridview_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
{
e.Cancel = true;
//Code for deleting will be added here.
}
The above event is triggerd w.r.t GVDeleterow.

Any questions on these shoot

No comments: