or
| <telerik:RadGrid ID="dgServices" runat="server" Width="99%" AutoGenerateColumns="False" |
| CellPadding="0" AllowMultiRowSelection="true" GridLines="Both" ShowFooter="true" AllowPaging="false"> |
| <ClientSettings EnableAlternatingItems="true" EnableRowHoverStyle="true" Selecting-AllowRowSelect="true"> |
| <Scrolling AllowScroll="true" /> |
| </ClientSettings> |
| <PagerStyle Mode="NumericPages" /> |
| <HeaderStyle Font-Bold="true" /> |
| <MasterTableView Width="98%" DataKeyNames="ServiceSeq"> |



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. }