ModalPopupExtender Error

2019-08-28 14:12发布

问题:

i want to popup ModalPopupExtender in button click, but when i run my code and click on the button then ModalPopupExtender is not popup even i used all the required AjaxControlToolkit references for this

my code is following :

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
    <asp:Panel ID="Panel1" runat="server" BackColor="#CC3300">
    hello...
    </asp:Panel>
    <asp:Button ID="Button1" runat="server" Text="click here" />

    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" TargetControlID="Button1">
    </asp:ModalPopupExtender>
</div>
</form>

i am using the visual studio 2008 Pro., .Net Framework 3.5 and for Ajax i used AjaxControlToolkit.dll(3.5.60919.0)

sir, plz give me solution for this..

回答1:

it can be your tags, try ajaxToolkit instead of asp tag

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" TargetControlID="Button1">
</ajaxToolkit:ModalPopupExtender>


回答2:

I believe your workaround lies here:

unknown server tag modalpopupextender

The error is related to the use of a master page in your site and was reportedly going to be fixed in a Visual Studio service pack (as of 2007, but not yet as of VS 2010 SP1). There is a simple workaround though that works for some folks (and did for me):

Open the master page first, then open the page with your ModalPopupExtender in it.