ModalPopupExtender server side Code in C #

I had a nightmare to make this happen.

Adding the ModalPopupExtender module to the form is easy, you run it and tell it the two necessary control parameters

PopupControlID="MyModalPanel" TargetControlID="ButtonToLoadIt" 

And it just works fine, but it is triggered by the client on the target side of the target element.

If you want to do the server side code behind ??? how to do it?

+6
source share
1 answer

A sample 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

+5
source

Source: https://habr.com/ru/post/951961/


All Articles