Search code examples
c#asp.nettelerikajaxcontroltoolkit

Pop up warning message


I would like to have a nice pop up warning that says "Are you sure you want to overwrite this file? Yes No. Is there any way to do this with telerik or Ajax Tool Kit?. I want to be able to control it on the server side too with c#

Thank you


Solution

  • one way could be

    1) create a div like a popup

    2) display the popup when some events occurs (like button click)

    3) if users click ok then doing somethings on server side

    4) if users click no then hide the div

    Here some code, sorry if there is some error but i don't have the environment on my hands.

    <head>
    <script type="text/javascript">
    function showConfirm()
    {
       var popup = document.getElementbyId('popup');
       popup.style.display = '';
    }
    function hide()
    {
       var popup = document.getElementbyId('popup');
       popup.style.display = 'none';
    
    }
    </script>
    </head>
    <body>
    <form runat="server" id="form1">
      <div id="popup" style="display:none">
        <p>bla bla bla</p>
        <asp:button id="btn_ok" runat="server" OnClick="ServerRountine_Click"/>
        <asp:button id="btn_ko" runat="server" onclientclick="hide();"/>
      </div>
    
    <asp:button id="btn_overwrite" runat="server" onclientclick="showConfirm();"/>
    </form>
    </body>