radconfirm

6 posts, 1 answers
  1. Jorge
    Jorge avatar
    8 posts
    Member since:
    Oct 2008

    Posted 11 Nov 2008 Link to this post

    Hi, used the follow code to call radconfir:
     
    System.Web.UI.ScriptManager.RegisterClientScriptBlock(UpdatePanel1, Me.GetType(), "SCRIPT""confirmSaveDuplicatePerson()"True

    and i used the javascript code
    function confirmSaveDuplicatePerson() 
    radconfirm('Are you sure?',confirmSaveCallback,330,100,null,'Duplicate'); 

    How can I know the value of the result. I want to doing this:

    if result=true then
    msgbox("true")
    'call some function
    else
    msgbox("false"
    end if

    I read in other post that you can know the value but in the javascript function and from there doing something, but i need know the value but in my VB code.

    Thanks




  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Nov 2008 Link to this post

    Hi Jorge,

    Radconfirm just as the standard confirm works on the client. Therefore, to perform any actions on the server side after you select Yes/No, you need to make a postback to the server.

    You can do this by placing an invisible server button on your page and then in the JavaScript callback function of radconfirm to invoke the "click" event of the button which will cause a postback. Then, in the event handler of the button you can perform the server side actions. Try the code snippets below.

    ASPX:
        <style type="text/css">  
        .buttons  
        {  
            display:none  
        }  
        </style>  
    <asp:Button ID="Button1" CssClass="buttons" runat="server" onclick="Button1_Click" Text="Button" />
     
    <asp:Button ID="Button2" CssClass="buttons" runat="server" onclick="Button2_Click" Text="Button" /> 
     
     
    <script language="javascript" type="text/javascript">  
    function confirmSaveDuplicatePerson()   
    {   
        radconfirm('Are you sure?',confirmCallBackFn,330,100,null,'Duplicate');   
    }   
    function confirmCallBackFn(arg)  
    {  
        if(arg == true)  
            {  
                document.getElementById("Button1").click();  
            }  
        if(arg == false)  
            {  
                __doPostBack("<%= Button2.ClientID %>","");    
            }  
    }  
    </script>  

    VB:
    Protected Sub Button1_Click(ByVal sender As ObjectByVal e As EventArgs) 
        'Result is "True" 
        'Call some function 
    End Sub 
     
    Protected Sub Button2_Click(ByVal sender As ObjectByVal e As EventArgs) 
        'Result is "False" 
        'Call some function 
    End Sub 

    Regards,
    Shinu.
  3. Jorge
    Jorge avatar
    8 posts
    Member since:
    Oct 2008

    Posted 12 Nov 2008 Link to this post

    You all right Shinu.

    Thanks for your help.
  4. waruni
    waruni avatar
    27 posts
    Member since:
    Jan 2008

    Posted 05 Jul 2009 Link to this post

    Hi,

    This is not work for me, I'm using master page,
    so it doesn't call a button events,
    can you please send us a sample.


    Thanks
  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 06 Jul 2009 Link to this post

    Hi waruni,

    If you are using MasterPage in this scenario, you should use the ClientID of the control:
    function confirmCallBackFn(arg)   
    {   
        if(arg == true)   
            {   
                document.getElementById("<%= Button1.ClientID %>").click();   
            }   
        if(arg == false)   
            {   
                __doPostBack("<%= Button2.ClientID %>","");     
            }   
    }   



    Kind regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. waruni
    waruni avatar
    27 posts
    Member since:
    Jan 2008

    Posted 06 Jul 2009 Link to this post

    Hi,

    Thanks for quick response. Its works  :)

    Thanks for your help.
Back to Top