'%s'的TargetControlID无效。该值不能为null或为空

时间:2012-09-17 20:56:07

标签: asp.net ajaxcontroltoolkit

我正在尝试使用ModalPopupExtender在ASP.net中弹出Panel

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" 
      EnableScriptGlobalization="true" EnableScriptLocalization="true">

<asp:LinkButton ID="bbShowExport" runat="server" Text="Export"></asp:LinkButton>

<asp:Panel ID="popupExport" runat="server">
   ...
</asp:Panel>

<asp:ModalPopupExtender ID="popupExtender" runat="server" 
      PopupControlID="popupExport" TargetControlID="bbShowExport">
</asp:ModalPopupExtender>

这意味着当用户点击popupExtender时,我希望popupExport弹出bbShowExport

访问该页面时出现错误:

  

'popupExtender'的TargetControlID无效。该值不能为null或为空。

我做错了什么?

2 个答案:

答案 0 :(得分:0)

在代码

之前添加此行
<Ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/>

答案 1 :(得分:0)

试试这个:

<asp:ScriptManager ID="ScriptMgrPopUp" runat="server"></asp:ScriptManager>
<asp:ModalPopupExtender ID="mpePopUpInformation" runat="server" PopupControlID="PanelInfo" TargetControlID="bbShowExport" CancelControlID="btnCloseInfo"></asp:ModalPopupExtender>
    <asp:Panel ID="PanelInfo" runat="server" CssClass="modalpopup">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" id="btnCloseInfo">×</button>
            <h3>Information</h3>
        </div>
        <div class="modal-body">
            <fieldset>
                Register Successfully Please Cek Email for Verification
            </fieldset>    
        </div>
    </asp:Panel>

<asp:LinkButton ID="bbShowExport" runat="server" Text="Export"></asp:LinkButton>