首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UpdatePanel的Modalpopup

UpdatePanel的Modalpopup
EN

Stack Overflow用户
提问于 2011-08-02 15:17:06
回答 2查看 4.4K关注 0票数 0

我有一个显示国家/地区列表的自动完成扩展程序。在同一文本框中,当我键入内容并单击“搜索”按钮时,应该会打开一个弹出窗口,并显示匹配的国家/地区。我正在为弹出窗口使用modalpopupextender。

aspx代码:

代码语言:javascript
复制
     <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
       <contenttemplate>
         <asp:TextBox id="TextBox1" runat="server" Width="250px"></asp:TextBox>
         <asp:ImageButton id="ImageButton1" onclick="imgBtnSearch_Click" runat="server" ImageUrl="~/Images/Lab/search.jpg"></asp:ImageButton>
         <cc1:AutoCompleteExtender id="TextBox1_AutoCompleteExtender" runat="server" EnableCaching="true" CompletionSetCount="10" MinimumPrefixLength="1" ServicePath="AutoComplete.asmx" UseContextKey="True" TargetControlID="TextBox1" ServiceMethod="GetCountryInfo">
        </cc1:AutoCompleteExtender> 
         <cc1:ModalPopupExtender id="ModalPopupExtender1" runat="server" TargetControlID="ImageButton1" BackgroundCssClass="ModalPopupBG" Drag="true" PopupDragHandleControlID="PopupHeader" PopupControlID="updatePanel2"  CancelControlID="btnCancel" ></cc1:ModalPopupExtender> 

     </contenttemplate>
     </asp:UpdatePanel>
  <asp:UpdatePanel id="updatePanel2" runat="server" UpdateMode="Conditional">
         <ContentTemplate>
                     <asp:RadioButtonList id="RadioButtonList1" runat="server" Width="400" Height="400" RepeatColumns="5" RepeatLayout="Table" RepeatDirection="Vertical" AutoPostBack="True"></asp:RadioButtonList> 

            <DIV class="Controls">
                <INPUT id="btnOk" type="button" value="OK" />
                <INPUT id="btnCancel" type="button" value="Cancel" />
            </DIV>

        </ContentTemplate>
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="ImageButton1" EventName="Click"></asp:AsyncPostBackTrigger>
        </Triggers>
    </asp:UpdatePanel> 

在我的代码中:

代码语言:javascript
复制
 protected void imgBtnSearch_Click(object sender, ImageClickEventArgs e) 
 {
   LoadCountryPopUp();
   ModalPopupExtender1.Show();
 }

我的弹出窗口中没有显示任何国家,尽管我通过我的自动完成扩展程序获得了结果。单击I按钮后,我得到的弹出窗口中没有任何内容。请帮帮我!

EN

回答 2

Stack Overflow用户

发布于 2011-08-02 16:41:46

将弹出内容放在面板中,如下所示:

代码语言:javascript
复制
<asp:UpdatePanel id="updatePanel2" runat="server" UpdateMode="Conditional">
         <ContentTemplate>
<asp:Panel id="pnlPopup" runat="server">
                     <asp:RadioButtonList id="RadioButtonList1" runat="server" Width="400" Height="400" RepeatColumns="5" RepeatLayout="Table" RepeatDirection="Vertical" AutoPostBack="True"></asp:RadioButtonList> 

            <DIV class="Controls">
                <INPUT id="btnOk" type="button" value="OK" />
                <INPUT id="btnCancel" type="button" value="Cancel" />
            </DIV>
</Panel>
        </ContentTemplate>
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="ImageButton1" EventName="Click"></asp:AsyncPostBackTrigger>
        </Triggers>
    </asp:UpdatePanel>

并将UpdatePanel的控件Id替换为此面板的id:

代码语言:javascript
复制
<cc1:ModalPopupExtender id="ModalPopupExtender1" runat="server" TargetControlID="ImageButton1" BackgroundCssClass="ModalPopupBG" Drag="true" PopupDragHandleControlID="PopupHeader" PopupControlID="pnlPopup"  CancelControlID="btnCancel" ></cc1:ModalPopupExtender>

看看它是不是能用?

票数 0
EN

Stack Overflow用户

发布于 2012-02-17 11:37:56

尝试将扩展器放在更新面板之外,它不应该是它正在扩展的子项

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6908494

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档