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

7 posts, 0 answers
  1. Meng
    Meng avatar
    57 posts
    Member since:
    Apr 2011

    Posted 07 Jun 2011 Link to this post

    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');
    }
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Jun 2011 Link to this post

    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.
  3. Meng
    Meng avatar
    57 posts
    Member since:
    Apr 2011

    Posted 08 Jun 2011 Link to this post

    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
  4. Vinoth
    Vinoth avatar
    2 posts
    Member since:
    Feb 2013

    Posted 21 Feb 2013 Link to this post

    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.
  5. Vinoth
    Vinoth avatar
    2 posts
    Member since:
    Feb 2013

    Posted 21 Feb 2013 Link to this post

    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.
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3869 posts

    Posted 21 Feb 2013 Link to this post

    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.
  7. Alice
    Alice avatar
    2 posts
    Member since:
    Feb 2017

    Posted 28 Feb in reply to Marin Bratanov Link to this post

    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?

Back to Top