简体   繁体   English

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

[英]Autocomplete extender not working inside modal popup extender

I am opening a popup in which I have a textbox.我正在打开一个弹出窗口,其中有一个文本框。 I want to use Ajax autocomplete extebder for this textbox.我想为此文本框使用 Ajax 自动完成扩展程序。 But it's not able to call the webservice method for autocompletion.但它无法调用 webservice 方法进行自动完成。 Can't understand weather it's a problem of postback or updatepanel.无法理解天气这是回发或更新面板的问题。

Where I should use the update panel?我应该在哪里使用更新面板? My page containing popup div is already inside "updatepanel1".我的包含弹出 div 的页面已经在“updatepanel1”中。

Code snap is given below.下面给出了代码快照。 Help Me...帮帮我...

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

You can just add Z-INDEX on CSS classes for the 3 parts of autocomplete-extender您可以为 autocomplete-extender 的 3 个部分在 CSS 类上添加Z-INDEX

******************** Autocomplete extender control ******************************* ********************自动完成扩展器控制*************************** ****

CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"

*********************** CSS ********************************* ************************ 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;
    }

create a JavaScript function.创建一个 JavaScript 函数。

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

and use the property in "AutoCompleteExtender"并使用“AutoCompleteExtender”中的属性

OnClientShown="PopupShown" 

This is much easier:这要容易得多:

  1. Create inside the modalpopup another div: <div ID="ListDivisor">在 modalpopup 中创建另一个 div:<div ID="ListDivisor">
  2. Set this property in your autocomplete extender: CompletionListElementID="ListDivisor"在您的自动完成扩展程序中设置此属性: CompletionListElementID="ListDivisor"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM