Folks, using UI for ASP.NET AJAX Q2 2014 SP1 with VS 2010.
In My Radgrid, I have Cancel Confirm both for Parent and Child Grid. Cancel Confirm works well in Parent Grid. Not an issue there.
But in Child Grid, Cancel Confirm does not work; edit form stays open. AllowAutomaticInserts="false" AllowAutomaticUpdates = "false" in Child Grid.
Below is my client side code.
Below is my Item command for the Command for the Child Grid.
Thanks for any Help.
gc_0620
In My Radgrid, I have Cancel Confirm both for Parent and Child Grid. Cancel Confirm works well in Parent Grid. Not an issue there.
But in Child Grid, Cancel Confirm does not work; edit form stays open. AllowAutomaticInserts="false" AllowAutomaticUpdates = "false" in Child Grid.
Below is my client side code.
function confirmCancelBackFnChild(arg) {
// var grid = $telerik.findControl(document.body, "RadGrid2");
var grid = $find("<%= RadGrid1.ClientID %>");
if (arg)
{
var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
var detailTable = grid.get_detailTables()[0];
var detailtableName = detailTable.get_name();
// alert(detailtableName);
document.getElementById('<%=HiddenField1.ClientID%>').value = "true";
// detailTable.fireCommand("CancelConfirmed", 0);
detailTable.fireCommand("CancelConfirmed", String.Empty);
}
else
{
document.getElementById('<%=HiddenField1.ClientID%>').value = "false";
}
document.getElementById('<%=HiddenField1.ClientID%>').value = "false";
}
Below is my Item command for the Command for the Child Grid.
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
RadGrid grid = (source as RadGrid);
if (true && e.Item.OwnerTableView.Name == "DemographicsDependants") // Child Table
{
switch (e.CommandName)
{
case "Cancel":
int searchlocation = 0;
string[] retrievedLocations = (string[])Session["LocationData"];
Array.Sort(retrievedLocations);
string location = Session["SessionOtherInfoFacilityName"].ToString().Trim();
searchlocation = Array.BinarySearch(retrievedLocations, location);
// if (HiddenField1.Value == "false" && searchlocation >= 0)
if (HiddenField1.Value == "false")
{
e.Canceled = true;
Session["savedIndex"] = e.Item.ItemIndex;
RadWindowManager1.RadConfirm("Continue with Cancel in Child Table? Warning, you will loose any unsaved work!!!", "confirmCancelBackFnChild", 350, 150, null, "Cancel Confirm");
}
break;
case "CancelConfirmed":
foreach (GridEditableItem item in RadGrid1.MasterTableView.DetailTables[0].GetItems(GridItemType.EditFormItem))
{
if (item.IsInEditMode && item.ItemIndex == (int)Session["savedIndex"])
{
item.FireCommandEvent("Cancel", String.Empty);
}
}
// HiddenField1.Value = "false";
break;
}
}
}
Thanks for any Help.
gc_0620