Hi all I would like to show a pop up on cancel event of both insert and edit of radgrid. Means when ever user clicks on cancel I would like to show a popup saying are you sure you want to cancel if yes means I would like to cancel the update or insert. If no I would like to make insert and edit as it is can some one help me
7 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 16 Oct 2012, 07:44 AM
Hi,
Try the following code to show a popup on clicking cancel button.
C#:
JS:
Thanks,
Shinu.
Try the following code to show a popup on clicking cancel button.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e){ if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem item = (GridEditableItem)e.Item; LinkButton link = (LinkButton)item.FindControl("CancelButton"); link.Attributes.Add("onclick", "popup();return false;"); }}<script type="text/javascript">function popup() { window.confirm("Do you sure you want to cancel?");}</script>Thanks,
Shinu.
0
Dorababu
Top achievements
Rank 1
answered on 16 Oct 2012, 07:56 AM
Thanks shinu how can I set edit mode to false when I click on Ok and to true when clicking on false in javascript
0
Dorababu
Top achievements
Rank 1
answered on 16 Oct 2012, 08:14 AM
Also is it possible to show Radwindowmanager instead of normal confirm
0
Shinu
Top achievements
Rank 2
answered on 17 Oct 2012, 04:14 AM
Hi,
In order to show radconfirm, try the following javascript. Make sure that you have RadWindowManager on the page. You can pass the response from the RadConfirm using AjaxRequest.
JS:
aspx:
C#:
Thanks,
Shinu.
In order to show radconfirm, try the following javascript. Make sure that you have RadWindowManager on the page. You can pass the response from the RadConfirm using AjaxRequest.
JS:
<script type="text/javascript">function popup(){ window.radconfirm("Do you sure you want to cancel?");//for showing radconfirm
}function confirmCallBackFn(arg) { var ajaxManager = $find("<%=RadAjaxManager1.ClientID%>"); if (arg) { ajaxManager.ajaxRequest('true'); } else { ajaxManager.ajaxRequest('false'); }}</script><telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager><telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e){ if (e.Argument.ToString() == "true") { //your code } else { //your code }}Thanks,
Shinu.
0
Dorababu
Top achievements
Rank 1
answered on 17 Oct 2012, 01:08 PM
Didn't worked can you attach a sample code if you have done this kind of requirement
0
NETSI
Top achievements
Rank 1
answered on 18 Dec 2019, 08:38 PM
This does not work as intended. The window will show on pressing Insert or Edit as well, not just on Cancel. Isn't there a way to differentiate the three from each other inside the ItemCreated event?
0
Hello,
You can achieve this requirement using the following approach:
function pageLoad(app, args) {
$telerik.$("div.RadGrid .rgEditForm .rgCancel").on("mousedown", function (e) {
if (confirm("Continue?")) {
this.click();
}
});
}
Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
