Link to home
Start Free TrialLog in
Avatar of abussie
abussie

asked on

ASP.NET AJAX Modal Popup Execute Server code

Here is my scenario I'm testing out the Modal Popup extender in the ASP.NET 2.0 AJAX Control Toolkit. I got the Modal Extendering working. However, I want to execute server side code once the user selects OK. I want the modal popup to disappear and execute the server side code.  Code snippet below


<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none" Width="233px">
   <p>Are you sure you want to Continue</p>
   <br />
   <div align="center">
      <asp:Button ID="OkButton" runat="server" Text="OK" />
      <asp:Button ID="CancelButton" runat="server" Text="Cancel" />
   </div>
   </asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="popup" runat="server" 
             TargetControlID="LinkButton1"
             PopupControlID="Panel1"
             BackgroundCssClass="modalBackground"
             DropShadow="true"
             OkControlID="OkButton"
             OnOkScript="onOk()"
             CancelControlID="CancelButton" />
 
<script type="text/javascript">
    function onOk()
    {
        
    }
</script>
 
Server code to execute
protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Label1.Text = "You clicked me!";
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of abussie
abussie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial