2011-08-02 57 views
0

我有一個顯示國家列表的autocomplexxtender。在同一個文本框中,當我輸入內容並點擊「搜索」按鈕時,應該打開一個彈出框並顯示匹配的國家。我正在使用modalpopupextender作爲彈出窗口。帶UpdatePanel的Modalpopup

ASPX代碼:

 <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> 

而且在我隱藏:

protected void imgBtnSearch_Click(object sender, ImageClickEventArgs e) 
{ 
    LoadCountryPopUp(); 
    ModalPopupExtender1.Show(); 
} 

,我沒有得到我的任何彈出的國家,雖然我得到通過我autocompleteextender結果。點擊圖像按鈕,我會得到沒有任何內容的彈出窗口。請幫忙!

回答

0

將您的彈出內容中板是這樣的:

<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> 

,並與該小組的ID替換的UpdatePanel的控制編號:

<cc1:ModalPopupExtender id="ModalPopupExtender1" runat="server" TargetControlID="ImageButton1" BackgroundCssClass="ModalPopupBG" Drag="true" PopupDragHandleControlID="PopupHeader" PopupControlID="pnlPopup" CancelControlID="btnCancel" ></cc1:ModalPopupExtender> 

,並檢查是否正常工作?

+0

嗨Waqas!感謝您的回覆。不,這是行不通的。(。 –

+0

你的彈出控件不顯示任何東西或它不只是加載國家的名單? – Waqas

+0

加載所有國家,並不會改變後,我在文本框中鍵入的東西。搜索按鈕,彈出窗口會顯示過濾後的數據,但如果我將img按鈕從updatepanel移出(如上所述),彈出窗口會顯示所有國家/地區。 –

-1

試着把擴展器放在更新面板的外面,它不應該是它擴展的孩子