tool bar confirm dialog

2 posts, 0 answers
  1. Kris
    Kris avatar
    11 posts
    Member since:
    Jul 2012

    Posted 23 Jul 2012 Link to this post

    I have a custom control "toolbar" my page and I have created a confirm dialog for one of the toolbar button. I need to hook-up some server side code from the javascript. Is is possible with telerik toolbar ? Thanks in advance. 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Jul 2012 Link to this post

    Hi Kris,

    To hook-up some server side code from the javascript You need a postback. 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 following code snippets.. 

    ASPX:
    <asp:Button ID="Button1" runat="server" CssClass="buttons"  Text="Button" onclick="Button1_Click" />

    CSS:
    <style type="text/css">
     .buttons
     {
      display:none;
     }
    </style>

    Javascript:
    <script type="text/javascript">
     function OnClientButtonClicked()
     {
      radconfirm('Are you sure!?', confirmCallBackFn);
     }
     function confirmCallBackFn(arg)
     {
      if (arg == true)
      {
       document.getElementById("Button1").click();
      }
     }
    </script>

    C#:
    protected void Button1_Click(object sender, EventArgs e)
    {
     // Your Code
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top