来自c#服务器端代码的ModalPopupExtender

时间:2022-04-17 03:48:56

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

将ModalPopupExtender添加到窗体中很容易,您将它放到窗体上并告诉它两个必需的控件参数

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 ?

如果你想做一些服务器端代码??? ?怎么做呢?

1 个解决方案

#1


5  

The example code is shown below:

示例代码如下所示:

HTML CODE:

HTML代码:

<!-- 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

c#代码

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

for ref s

ref的年代

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

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

#1


5  

The example code is shown below:

示例代码如下所示:

HTML CODE:

HTML代码:

<!-- 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

c#代码

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

for ref s

ref的年代

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

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