自动完成扩展程序在模态弹出扩展程序中不起作用

时间:2013-12-30 10:31:33

标签: c# asp.net

我正在打开一个弹出框,其中有一个文本框。我想为此文本框使用Ajax自动完成扩展程序。但它无法调用webservice方法进行自动完成。无法理解天气,这是回发或更新面板的问题。

我应该在哪里使用更新面板?我的包含popup div的页面已经在" updatepanel1"。

代码捕捉如下。帮助我...

 <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"   ChildrenAsTriggers="false" >

    <asp:TextBox ID="txtEditMPName" runat="server" Width="408px" AutoPostBack="true"        BackColor="#CCFFFF" OnTextChanged="txtEditMPName_TextChanged">
    <cc1:AutoCompleteExtender ID="ace2" runat="server" BehaviorID="autoSuggest" 
  DelimiterCharacters="" Enabled="true" MinimumPrefixLength="1" ServiceMethod="GetParty" CompletionInterval="10" EnableCaching="true"   CompletionSetCount="1" OnClientShown="ShowOptions"
  TargetControlID="txtEditMPName" FirstRowSelected="True" CompletionListCssClass="AutoCompleteCompletionList" CompletionListHighlightedItemCssClass="AutoCompleteCompletionListHighlightedItem" CompletionListItemCssClass="AutoCompleteCompletionListItem">
    <Triggers>
      <asp:AsyncPostBackTrigger ControlID="txtEditMPName" EventName="TextChanged" />
    </Triggers>
  </asp:UpdatePanel>

3 个答案:

答案 0 :(得分:1)

你可以在3个autocomplete-extender的CSS类上添加 Z-INDEX

******************** 自动填充扩展程序控件 ************** *****************

CompletionListCssClass = “autocomplete_completionListElement” CompletionListItemCssClass =“autocomplete_listItem”CompletionListHighlightedItemCssClass =“autocomplete_highlightedListItem”

*********************** CSS ************* ********************

    /* AutoComplete highlighted item */
    .autocomplete_completionListElement
    {
        margin: 0px !important;
        z-index:99999 !important;
        background-color: ivory;
        color: windowtext;
        border: buttonshadow;
        border-width: 1px;
        border-style: solid;
        cursor: 'default';
        overflow: auto;
        height: 200px;
        text-align: left;
        left: 0px;
        list-style-type: none;
    }
    /* AutoComplete highlighted item */
    .autocomplete_highlightedListItem
    {
        z-index:99999 !important;
        background-color: #ffff99;
        color: black;
        padding: 1px;
        cursor:hand;
    }
    /* AutoComplete item */
    .autocomplete_listItem
    {
        z-index:99999 !important;
        background-color: window;
        color: windowtext;
        padding: 1px;
        cursor:hand;
    }

答案 1 :(得分:1)

创建一个JavaScript函数。

function PopupShown(sender, args) {
        sender._popupBehavior._element.style.zIndex = 99999999;
    }

并在&#34; AutoCompleteExtender&#34;

中使用该属性
OnClientShown="PopupShown" 

答案 2 :(得分:0)

这更容易:

  1. 在modalpopup内部创建另一个div:
  2. 在自动完成扩展程序中设置以下属性:CompletionListElementID =“ ListDivisor”