ModalPopupExtender从服务器端代码在c# [英] ModalPopupExtender from Server Side Code in c#
本文介绍了ModalPopupExtender从服务器端代码在c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将ModalPopupExtender添加到窗体很容易,你可以放下它,告诉它两个必需的控件参数
PopupControlID =MyModalPanel
TargetControlID =ButtonToLoadIt
它只是工作正常,但是由客户端点击目标控件触发。
想做一些服务器端代码吗?如何做?
解决方案
示例代码如下所示:
HTML CODE:
<! - Hidden Field - >
< asp:HiddenField ID =hidForModelrunat =server/>
< asp:ModalPopupExtender
ID =WarningModal
TargetControlID =hidForModel
runat =server
CancelControlID =btnWarning
DropShadow =true
PopupControlID =pnlIssues>
< / asp:ModalPopupExtender>
<! - Panel - >
< asp:Panel ID =pnlIssuesrunat =server
BorderColor =BlackBorderStyle =Outset
BorderWidth =2BackColor =Wheat 400pxHeight =106px>
< center>
< h2 class =style2>
信息< / h2>
< p>
< h3> < asp:Label ID =lblWarning
runat =server> < / asp:Label>< / h3>
< / p>
<! - 在面板中关闭弹出式窗口的标签 - >
< asp:ImageButton ID =btnWarningrunat =server
ImageUrl =〜/ images / buttons / update.png/>
< / center>
< / asp:Panel>
C#代码
code> WarningModal.Show();
lblWarning.Text =这是一个弹出警告;
参考
http://www.codeproject.com/Tips/215040/ModalPopupExtender-from-服务器端代码
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 ?
解决方案
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
这篇关于ModalPopupExtender从服务器端代码在c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文