Hi,
I have created a radgrid that uses an editformtemplate to allow for inserts and updates to data. We are using our own code to insert data into the database and to update the data in the database. In the formtemplate we have the update button being set to different commands based on the container. We also have a cancel button in the form.
If the user is editing a record and presses the cancel button the screen will refresh and the form is gone leaving only the grid. If the user is creating a record and presses the cancel button the screen will refreash but the form is still present on the screen. Here is the code we are currently using in the itemcommand event of the radgrid:
I have created a radgrid that uses an editformtemplate to allow for inserts and updates to data. We are using our own code to insert data into the database and to update the data in the database. In the formtemplate we have the update button being set to different commands based on the container. We also have a cancel button in the form.
If the user is editing a record and presses the cancel button the screen will refresh and the form is gone leaving only the grid. If the user is creating a record and presses the cancel button the screen will refreash but the form is still present on the screen. Here is the code we are currently using in the itemcommand event of the radgrid:
protected void rgFormFields_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == "Cancel")
{
e.Canceled =
true;
rgFormFields.MasterTableView.ClearEditItems();
rgFormFields.Rebind();
}
else if (e.CommandName == "Update")
{
Update(e);
e.Canceled =
true;
rgFormFields.MasterTableView.ClearEditItems();
rgFormFields.Rebind();
}
else if (e.CommandName == "PerformInsert")
{
//bAddNewFormField_Click(source, e);
Insert(e);
e.Canceled =
true;
rgFormFields.MasterTableView.ClearEditItems();
rgFormFields.Rebind();
}
}
Anyhelp would be greatly appreciated.
Thanks,
Jonathan