东儿童
爱拼才会赢

ModalPopup 如何由客户端来控制

 

请看例子:(很一般)

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:TextBox ID="TextBox1" runat="server" style="display:none;" />
<asp:Panel runat="server" ID="popupPanel"
style="border: solid 1px black; padding: 10px; width: 300px; display:none;">
<b style="font-size: 15pt;">Here's the Message</b>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
</asp:Panel>
<ajaxToolkit:ModalPopupExtender runat="server"
TargetControlID="TextBox1" PopupControlID="popupPanel"
OkControlID="Button1" BehaviorID="modalPopup" />

然后,我们就可以在客户端放置一个按钮,然后使用JavaScript弹出窗口了。请注意,我们使用了$find通过BehaviorID来得到了ModalPopupBehavior实例,然后调用它的show方法:

js控制   $find('Panel1').hide()
    $find(
'Panel1').show()

前提是,PopupControlID和BehaviorID都要是Panel1

 

<input type="button" value="Popup" onclick="$find('modalPopup').show();" />
posted on 2008-08-13 17:44  哎!无悔  阅读(344)  评论(0编辑  收藏  举报