Delete confirmation with RadAjaxLoadingPanel is not working ???
<asp:Button ID="btnDel" runat="server" Text="delete" OnClick="OnDeleteNom" OnClientClick="javascript:return confirm('delete item?')" />
code behind
protected void OnDeleteNom(object sender, EventArgs e)
{
//???
never comes here
}
Thanks,
Mehmedov
9 Answers, 1 is accepted
0
Hi Nurietin,
It is very difficult to determine the exact cause of the problem just from the provided information. Can you please elaborate some more on the issue.
If you are using ajax, try to disable it and see if the problem persists.
An alternate approach would be to enable your script debugging and confirm that no javascript errors are interfering.
It'd be best if you can provide us some more information on your project or send us the full markup of the page as well as the related code behind. Thus we will be able to further research on the problem and do our best to provide a proper solution.
Kind regards,
Eyup
the Telerik team
It is very difficult to determine the exact cause of the problem just from the provided information. Can you please elaborate some more on the issue.
If you are using ajax, try to disable it and see if the problem persists.
An alternate approach would be to enable your script debugging and confirm that no javascript errors are interfering.
It'd be best if you can provide us some more information on your project or send us the full markup of the page as well as the related code behind. Thus we will be able to further research on the problem and do our best to provide a proper solution.
Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Nurietin
Top achievements
Rank 1
answered on 03 Apr 2012, 07:47 AM
Hi,Eyup
this is Documents.aspx
<%@ Page Title="Documents" Language="C#" AutoEventWireup="false" CodeBehind="Documents.aspx.cs"
Inherits="Archimed.Web.HotelRegister.Documents" %>
<%@ Register TagPrefix="dv" TagName="DocumentView" Src="Controls/DocumentView.ascx" %>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<telerik:RadAjaxPanel ID="pnlRadAjax" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
<dv:DocumentView ID="dv:DocumentView " runat="server" />
</telerik:RadAjaxPanel>
this is DocumentView.ascx (asp control)
<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="DocumentView.ascx.cs"
Inherits="Archimed.Web.HotelRegister.Controls.DocumentView" %>
<asp:Button ID="btnCopy" runat="server" Text="Copy" OnClick="OnCopy" />
<asp:Button ID="btnDelID" runat="server" Text="delete" OnClick="OnDelete" OnClientClick="javascript:return confirm('Confirm delete?')"/>
OnDelete method not firing on code behind but OnCopy is fine
???
this is Documents.aspx
<%@ Page Title="Documents" Language="C#" AutoEventWireup="false" CodeBehind="Documents.aspx.cs"
Inherits="Archimed.Web.HotelRegister.Documents" %>
<%@ Register TagPrefix="dv" TagName="DocumentView" Src="Controls/DocumentView.ascx" %>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
<telerik:RadAjaxPanel ID="pnlRadAjax" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
<dv:DocumentView ID="dv:DocumentView " runat="server" />
</telerik:RadAjaxPanel>
this is DocumentView.ascx (asp control)
<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="DocumentView.ascx.cs"
Inherits="Archimed.Web.HotelRegister.Controls.DocumentView" %>
<asp:Button ID="btnCopy" runat="server" Text="Copy" OnClick="OnCopy" />
<asp:Button ID="btnDelID" runat="server" Text="delete" OnClick="OnDelete" OnClientClick="javascript:return confirm('Confirm delete?')"/>
OnDelete method not firing on code behind but OnCopy is fine
???
0
Hi Nurietin,
In order to solve your issue you have two options:
JavaScript:
Hope this helps. Good luck with your project.
Regards,
Eyup
the Telerik team
In order to solve your issue you have two options:
- remove the return statement from your javascript on OnClientClick event:
<
asp:Button
...
OnClientClick
=
"javascript: confirm('Confirm delete?')"
/>
- replace your javascript declaration with a relevant function:
<
asp:Button
...
OnClientClick
=
"DeleteConfirmation()"
/>
<
script
type
=
"text/javascript"
>
{
function DeleteConfirmation(sender, args) {
confirm('Confirm delete?')
}
}
</
script
>
Hope this helps. Good luck with your project.
Regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Nurietin
Top achievements
Rank 1
answered on 05 Apr 2012, 08:31 AM
Hi,
Eyup
how can I get confirm result from DeleteConfirmation java script function??
in code behind
Eyup
how can I get confirm result from DeleteConfirmation java script function??
in code behind
protected void onDelete(Object sender, EventArgs e)
{
???
}
Thanks,
Nurietin
0

Princy
Top achievements
Rank 2
answered on 05 Apr 2012, 10:10 AM
Hi,
To get the confirm value in the server you can invoke an AJAX request through the RadAjaxManager as follows.
ASPX:
JS:
C#:
Thanks,
Princy.
To get the confirm value in the server you can invoke an AJAX request through the RadAjaxManager as follows.
ASPX:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
onajaxrequest
=
"RadAjaxManager1_AjaxRequest"
>
</
telerik:RadAjaxManager
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
OnClientClick
=
"DeleteConfirmation();"
/>
JS:
<script type=
"text/javascript"
>
function
DeleteConfirmation(sender, args)
{
var
value = confirm(
"dfg"
);
ajaxmanager = $find(
"<%= RadAjaxManager1.ClientID%>"
);
if
(!value)
{
ajaxmanager.ajaxRequest(
"Cancel"
);
}
else
{
ajaxmanager.ajaxRequest(
"Ok"
);
}
}
</script>
C#:
protected
void
RadAjaxManager1_AjaxRequest(
object
sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
if
(e.Argument ==
"Ok"
)
{
Response.Write(
"OK"
);
}
else
if
(e.Argument ==
"Cancel"
)
{
Response.Write(
"CANCEL"
);
}
}
Thanks,
Princy.
0

Nurietin
Top achievements
Rank 1
answered on 05 Apr 2012, 01:40 PM
Hi, Princy
now I have got this error ???
Microsoft JScript runtime error: Unable to get value of the property 'ajaxRequest': object is null or undefined
now I have got this error ???
Microsoft JScript runtime error: Unable to get value of the property 'ajaxRequest': object is null or undefined
var
value = confirm(Confirm?');
ajaxmanager = $find(
"<%= pnlRadAjax.ClientID%>");
if (!value) {
ajaxmanager.ajaxRequest(
"Cancel");
}
else {
ajaxmanager.ajaxRequest(
"Ok");
}
0
Hi Nurietin,
You can also try the following approach:
All the best,
Eyup
the Telerik team
You can also try the following approach:
- create a hidden field in your mark-up:
<
asp:HiddenField
ID
=
"hidden1"
runat
=
"server"
/>
- assign it the result from your confirmation demand:
<
script
type
=
"text/javascript"
>
{
function DeleteConfirmation(sender, args) {
var hiddenField = $find("<%= hidden1.ClientID%>");
var result = confirm('Confirm delete?')
$get('<%=hidden1.ClientID %>').value = result;
}
}
</
script
>
- use this value in the code behind for further action:
protected
void
OnDelete(
object
sender, EventArgs e)
{
if
(
bool
.Parse(hidden1.Value))
{
//do something if confirmed
}
else
{
//do something else if canceled
}
}
All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Nurietin
Top achievements
Rank 1
answered on 11 Apr 2012, 03:31 PM
Hi,
I have
But the problem again is
Microsoft JScript runtime error: Unable to set value of the property 'value': object is null or undefined
I have
<
asp:HiddenField
ID
=
"hidden1"
runat
=
"server"
/>
But the problem again is
Microsoft JScript runtime error: Unable to set value of the property 'value': object is null or undefined
var hiddenField = $find("<%= hidden1.ClientID%>");
variable hiddenField is null
0

Nurietin
Top achievements
Rank 1
answered on 12 Apr 2012, 08:12 AM
I found the solution
<input id="HiddenConfirmResult" type="hidden" runat="server" />
<script type="text/javascript">
function DeleteConfirmation() {
var result = confirm("Confirm delete ?");
document.getElementById('<%=HiddenConfirmResult.ClientID%>').value = result;
}
</script>
code behind
if (bool.Parse(HiddenConfirmResult.Value))
{
//true
}
else
{
} // false
<input id="HiddenConfirmResult" type="hidden" runat="server" />
<script type="text/javascript">
function DeleteConfirmation() {
var result = confirm("Confirm delete ?");
document.getElementById('<%=HiddenConfirmResult.ClientID%>').value = result;
}
</script>
code behind
if (bool.Parse(HiddenConfirmResult.Value))
{
//true
}
else
{
} // false