• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2493
  • Last Modified:

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

0
abussie
Asked:
abussie
1 Solution

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now