Folks
using RadControls for ASP.NET AJAX Q3 2013 with VStudio 10. I am using below link as Prototype.
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx
My Radgrid has Filter enabled. Below are my steps to reproduce the error:
1) Filtered the Grid with some condition; Grid has no Rows.
2) Clicked Add New Command Item link Button.
3) Now can't Cancel Insert operation from Form Template. Edit Form Stays open.
4) But if Grid has some rows, Cancel Insert operation works perfectly.
Below is my Code. Any help will be appreciated.
Thanks
Gc_0620
_________
using RadControls for ASP.NET AJAX Q3 2013 with VStudio 10. I am using below link as Prototype.
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx
My Radgrid has Filter enabled. Below are my steps to reproduce the error:
1) Filtered the Grid with some condition; Grid has no Rows.
2) Clicked Add New Command Item link Button.
3) Now can't Cancel Insert operation from Form Template. Edit Form Stays open.
4) But if Grid has some rows, Cancel Insert operation works perfectly.
Below is my Code. Any help will be appreciated.
Thanks
Gc_0620
_________
01.protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)02. {03. if (true && e.Item.OwnerTableView.Name == "MainClient") //validated04. {05. switch (e.CommandName)06. {07. case "Cancel":08. 09. if (HiddenField1.Value == "false")10. {11. e.Canceled = true;12. Session["savedIndex"] = e.Item.ItemIndex;13. RadWindowManager1.RadConfirm("Continue with Cancel? Warning, you will loose any unsaved work!!!",14. "confirmCancelBackFnMain", 350, 150, null, "Cancel Confirm");15. }16. 17. break;18. case "CancelConfirmed":19. foreach (GridEditableItem item in RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem))20. {21. if (item.IsInEditMode && item.ItemIndex == (int)Session["savedIndex"])22. {23. item.FireCommandEvent("Cancel", String.Empty);24. }25. }26. HiddenField1.Value = "false";27. break;28. }29. }30. }31. 32. __________33. 34. function confirmCancelBackFnMain(arg)35. {36. var grid = $find("<%= RadGrid1.ClientID %>");37. if (arg)38. {39. //alert(document.getElementById('<%=HiddenField1.ClientID%>').value);40. document.getElementById(41. '<%=HiddenField1.ClientID42. %>').value = "true";43. grid.get_masterTableView().fireCommand("CancelConfirmed", String.Empty);44. }45. else46. {47. document.getElementById(48. '<%=HiddenField1.ClientID49. %>').value = "false";50. }51. 52. document.getElementById(53. '<%=HiddenField1.ClientID54. %>').value = "false";55. }