ASP.NET Ajax & ModalPopupExtender doesn't show up
I'm not able to get my panel popup using ModalPopupExtender. Here's the code
.modalBackground
{
background-color:#CCCCFF;
filter:alpha(opacity=40);
display:none;
opacity:0.5;
}
.ModalWindow
{
border: solid1px#c0c0c0;
background:#f0f0f0;
padding: 0px 10px 10px 10px;
position:absolute;
top:-1000px;
left:-1000;
}
And the code:
<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Panel ID="panEdit" runat="server" Height="180px" Width="400px" CssClass="modalBackground">
Content goes here
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</asp:Panel>
<asp:LinkButton runat="server" ID="btnPopup" Text="pop" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" RepositionMode="RepositionOnWindowResize"
TargetControlID="btnPopup" PopupControlID="panEdit" BackgroundCssClass="modalBackground"
CancelControlID="btnCancel">
</asp:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
When I click btnPopup, noth开发者_开发问答ing happens. Any idea?
probably too late to help, but if anyone else stumbles upon this, I'm pretty sure the answer is to replace:
<asp:ScriptManager runat="server"></asp:ScriptManager>
with
<asp:ToolkitScriptManager ID="whatever" runat="server">
your popup isn't getting the behaviors from the right js set. once you've installed the AjaxControlToolkit, the ToolkitScriptManager is available. this little side note is unfortunately not included in the step-by-step installation instructions.
one more thing. replace -1000;
with -1000px;
Where did you get this code ? With this parameters on css I do not think that you ever see a modal.
top:-1000px;
left:-1000;
Anyway I think that you must follow the example that give by MS and just copy/paste and work on that example. The example is totally different from you.
get the sdk from http://www.asp.net/ajaxlibrary/download.ashx and then search on the examples for the ModalPopUp
精彩评论