This is a migrated thread and some comments may be shown as answers.

Is there any easy way to use radconfirm like using asp.net confirm?

6 Answers 242 Views
Window
This is a migrated thread and some comments may be shown as answers.
Meng
Top achievements
Rank 1
Meng asked on 07 Jun 2011, 09:15 PM

Hi there,

I am trying to use radconfirm instead of the asp.net confirm window. Following is my code for the asp.net delete confirmation window:

function Confirm_Delete() {
    if (confirm("Are you sure you want to delete this?") == true)
        return true;
    else
        return false;
}
<asp:Button ID="bt_Delete" runat="server" Text ="Delete" onclick="bt_Delete_Click" OnClientClick="return Confirm_Delete()" />

I have done the following changes in the javascript file, but it just show the delete confirmation window for a second, and then deleted the record without my input of Ok or not, Could anyone please let me know how to fix this issue? Thanks.
 
function confirmCallBackFn(arg) {
    return arg;
}
  
function Confirm_Delete() {
    radconfirm('<h3 style=\'color: #333399;\'>Are you sure you want to delete this?</h3>', confirmCallBackFn, 330, 100, null, 'Delete Confirmation');
}

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Jun 2011, 07:18 AM
Hello Meng,

Try the following approach to set radconfirm in a button click.

aspx:
<button onclick="radconfirm('Are you sure?', confirmCallBackFn); return false;">
alert</button>
<asp:Button ID="Button1" runat="server" Text="alert" OnClick="Button1_Click1" />

Javascript:
function confirmClearSingleCallBack(args)
{
    alert(args);
}

You can also set radconfirm from server side with the following approach.

C#:
protected void Button1_Click1(object sender, EventArgs e)
{
  string radalertscript = "<script language='javascript'>function f(){ radconfirm('Are you sure ', confirmClearSingleCallBack, 400, 100) ; Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
 }

Also check the following help documentation article which explains more about this.
Working with the Confirm Dialog.

Thanks,
Princy.
0
Meng
Top achievements
Rank 1
answered on 08 Jun 2011, 03:10 PM
Thank you very much for your help, Princy. Confirm postback with radconfirm is all that i want.

http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx
0
Vinoth
Top achievements
Rank 1
answered on 21 Feb 2013, 10:22 AM
hi,
i am using the following code for rad confrim but its not return correct value, my code is here.
<asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="btnDelete_Click"  />
This is the callfuction script:
function confirmCallBackFn(arg) { 
if(arg){
        return true;
}
else{
        return false;
    }
}
and CS code here:
protected void Page_Load(object sender, EventArgs e)
    {
        btnDelete.Attributes.Add("onclick", "radconfirm('Do you want to delete these records?', CallBackFn, 330, 100, null,'Confirm'); return false;");
 }
after these calling this javascript it want to send the true or false to onclick event. but it always retrun false only.
0
Vinoth
Top achievements
Rank 1
answered on 21 Feb 2013, 10:26 AM
hi,
i am using the following code for rad confrim but its not return correct value, my code is here.
<asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="btnDelete_Click"  />
This is the callfuction script:
function confirmCallBackFn(arg) { 
if(arg){
        return true;
}
else{
        return false;
    }
}
and CS code here:
protected void Page_Load(object sender, EventArgs e)
    {
        btnDelete.Attributes.Add("onclick", "radconfirm('Do you want to delete these records?', CallBackFn, 330, 100, null,'Confirm'); return false;");
 }
after these calling this javascript it want to send the true or false to onclick event. but it always retrun false only.
0
Marin Bratanov
Telerik team
answered on 21 Feb 2013, 10:40 AM
Hi guys,

This demo shows how this can be done as easily as possible and also offers detailed explanations on the approach, its peculiarities and limitations: http://demos.telerik.com/aspnet-ajax/window/examples/confirmserverclicks/defaultcs.aspx.


Kind regards,
Marin Bratanov
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
Alice
Top achievements
Rank 1
answered on 28 Feb 2017, 02:41 PM

When I click on a link in the text, I make a check using RadConfirm to check with the user if he wants to redirect to another page. Now the radconfirm prompts and waits for input if the link is a page within my website. But if its a link to another website, my radconfirm still fires, but doesn't wait for user prompt but redirects to external url anyway.

I used return false; at the end of radconfirm(); Still no luck. Can you help?

Tags
Window
Asked by
Meng
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Meng
Top achievements
Rank 1
Vinoth
Top achievements
Rank 1
Marin Bratanov
Telerik team
Alice
Top achievements
Rank 1
Share this question
or