I am trying to do an insert in editForm in a RadGrid nested in another RadGrid's editform. I need a way to tell the parent grid to close its editForm.
I have a RadGrid (RadGridMain) that lets the user display and edit some data. It works fine for update and delete.
In order to do inserts and updates using slightly different processes, I have an Edit.ascx and an Insert.ascx. The OnItemCommand adjusts the user control appropriately like:
The reason that I am loading the insert control and assigning the NeedDataSource is that I am doing this in SharePoint, and this seems to be the best way.
So, the insert.ascx control gives the user a RadGrid (let's call it radGridInsert) to select an item to associate with and then opens up an editform in radGridInsert to do the insert. Once the insert is done, they click Save and the RadGridInsertSelector editform closes. This works great.
The catch is that when they save or cancel in the radGridInsert editForm, I want to tell the outer RadGrid (RadGridMain) to stop editing and close its editform. The only way that I have been able to do it so far is by having a button that calls the cancel command in the ascx outside the RadGridInsertSelector.
In the radGridInsert_OnInsertCommand, I can save the data and close the radGridInsert editform, but I need a way to pass this to the parent so that it closes its editform.
In radGridInsert_OnInsertCommand, I have tried calling
and
Any suggestions would be greatly appreciated.
Thanks
I have a RadGrid (RadGridMain) that lets the user display and edit some data. It works fine for update and delete.
In order to do inserts and updates using slightly different processes, I have an Edit.ascx and an Insert.ascx. The OnItemCommand adjusts the user control appropriately like:
01.
protected void RadGridMain_OnItemCommand(object sender, GridCommandEventArgs e)
02.
{
03.
if (e.CommandName == RadGrid.InitInsertCommandName)
04.
{
05.
RadGridMain.MasterTableView.EditFormSettings.UserControlName = "~/Insert.ascx"
06.
07.
// Set up the control
08.
Control control = Page.LoadControl("~/Insert.ascx");
09.
RadGrid radGridInsert = control.FindControl("radGridInsert") as RadGrid;
10.
11.
radGridInsert.NeedDataSource += RadGridInsertSelector_OnNeedDataSource;
12.
13.
// give the child a handle to the parent
14.
PSC.Controls.UdcsConnectionInsert.ParentRadGrid = RadGridMain;
15.
}
16.
else if (e.CommandName == RadGrid.EditCommandName)
17.
{
18.
RadGridMain.MasterTableView.EditFormSettings.UserControlName = "~/Edit.ascx";
19.
}
20.
}
The reason that I am loading the insert control and assigning the NeedDataSource is that I am doing this in SharePoint, and this seems to be the best way.
So, the insert.ascx control gives the user a RadGrid (let's call it radGridInsert) to select an item to associate with and then opens up an editform in radGridInsert to do the insert. Once the insert is done, they click Save and the RadGridInsertSelector editform closes. This works great.
The catch is that when they save or cancel in the radGridInsert editForm, I want to tell the outer RadGrid (RadGridMain) to stop editing and close its editform. The only way that I have been able to do it so far is by having a button that calls the cancel command in the ascx outside the RadGridInsertSelector.
In the radGridInsert_OnInsertCommand, I can save the data and close the radGridInsert editform, but I need a way to pass this to the parent so that it closes its editform.
In radGridInsert_OnInsertCommand, I have tried calling
ParentRadGrid.MasterTableView.IsItemInserted = false;
and
GridEditFormItem editFormItem = e.Item as GridEditFormItem;
GridDataItem parentItem = editFormItem.ParentItem;
parentItem.EditFormItem.Edit = false;
Any suggestions would be greatly appreciated.
Thanks