admin管理员组文章数量:1334802
I have a modal popup extender as follows
<div id="target" runat="server"></div>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID ="Modal"
runat="server" TargetControlID="target"
BackgroundCssClass="modalBackground"
PopupControlID="Panel1"></cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server">
<asp:Login ID="Login1" Width="360px" Height="135px" BackColor="lightSteelBlue"
LoginButtonStyle-BorderStyle="groove" TextBoxStyle-CssClass="textbox"
LoginButtonStyle-CssClass="loginbutton" runat="server" >
<TextBoxStyle CssClass="textbox" />
<LoginButtonStyle BorderStyle="Groove" CssClass="loginbutton" />
</asp:Login>
</asp:Panel>
On clicking on one button i have to show modalpopup. What code i can write in JavaScript to call modalpopup.Can anybody help.
I have a modal popup extender as follows
<div id="target" runat="server"></div>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID ="Modal"
runat="server" TargetControlID="target"
BackgroundCssClass="modalBackground"
PopupControlID="Panel1"></cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server">
<asp:Login ID="Login1" Width="360px" Height="135px" BackColor="lightSteelBlue"
LoginButtonStyle-BorderStyle="groove" TextBoxStyle-CssClass="textbox"
LoginButtonStyle-CssClass="loginbutton" runat="server" >
<TextBoxStyle CssClass="textbox" />
<LoginButtonStyle BorderStyle="Groove" CssClass="loginbutton" />
</asp:Login>
</asp:Panel>
On clicking on one button i have to show modalpopup. What code i can write in JavaScript to call modalpopup.Can anybody help.
Share Improve this question edited Apr 21, 2018 at 19:37 Stephen Docy 4,7887 gold badges21 silver badges31 bronze badges asked Aug 14, 2009 at 10:02 user42348user42348 4,32928 gold badges73 silver badges99 bronze badges 03 Answers
Reset to default 2var modalDialog = $find("ModalPopupExtender1");
// get reference to modal popup using the AJAX api $find() function
if (modalDialog != null) {
modalDialog.show();
}
The point of the ModalPopupExtender is that you do not have to write any JS. It does all the plumbing for you. You can look up the ASP.Net AJAX Controltoolkit Website for a manual on how to configure it: http://www.asp/AJAX/AjaxControlToolkit/Samples/ModalPopup/ModalPopup.aspx
As Manu has already said, you don't need to write any javascript to trigger the popup.
All you need to do is drop a LinkButton onto the page and set that as the TargetControlID
<cc1:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID ="Modal"
runat="server" TargetControlID="lbOpenModal"
BackgroundCssClass="modalBackground"
PopupControlID="Panel1"></cc1:ModalPopupExtender>
<asp:LinkButton id="lbOpenModal" runat="server" Text="Click me"></asp:LinkButton>
Then when you click the link, the modal will open.
本文标签: aspnetTo show Modalpopup in JavaScriptStack Overflow
版权声明:本文标题:asp.net - To show Modalpopup in JavaScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742346192a2457568.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论