ModalPopupExtender from Server Side Code in c#

ajax, c#-4.0

Solution

The example code is shown below:

HTML CODE:

<!-- Hidden Field -->
<asp:HiddenField ID="hidForModel" runat="server" />

<asp:ModalPopupExtender
ID="WarningModal"
TargetControlID="hidForModel"
runat="server"
CancelControlID="btnWarning"
DropShadow="true"
PopupControlID="pnlIssues" >
</asp:ModalPopupExtender>

<!-- Panel -->
<asp:Panel ID="pnlIssues" runat="server"  
BorderColor="Black" BorderStyle="Outset"  
BorderWidth="2" BackColor="Wheat" Width="400px"  Height="106px">
   <center>
       <h2 class="style2">
           Information</h2>
       <p>

         <h3> <asp:Label ID="lblWarning" 
runat="server"> </asp:Label></h3>
       </p>

 <!-- Label in the Panel to turn off the popup -->
 <asp:ImageButton ID="btnWarning" runat="server"
                ImageUrl="~/images/buttons/update.png" />
</center>

</asp:Panel>

C# Code

WarningModal.Show();
lblWarning.Text = "This is a popup warning";

for ref s

http://www.codeproject.com/Tips/215040/ModalPopupExtender-from-Server-Side-Code

Problem

I had a nightmare getting this going. Adding the ModalPopupExtender to a form is easy, you drop it on and tell it the two required controls parameters ``` PopupControlID="MyModalPanel" TargetControlID="ButtonToLoadIt" ``` And it just works fine, but is triggered by a client side click of the Target Control. If you want to do some server side code behind??? how to do it ?

Original source