Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
19 Points
12 Posts
Mar 29, 2010 06:04 PM|LINK
I need to have the contextKey determined by a TextBox. I am trying the approach by kirtid.
function AutoCompleteContextKeys() { var autoComplete = $find('autoCompleteState'); var autoComplete2 = document.getElementById('<%= this.autoCompleteState.ClientID %>'); if (autoComplete == null) alert("autoComplete is null"); if (autoComplete2 == null) alert("autoComplete2 is null"); if (!autoComplete) return; var target = autoComplete.get_element(); if (!target) return; var userContext = $get('edtCountry'); if (!userContext) return; // Dynamically assign the context autoComplete.add_populating( function() { autoComplete.set_contextKey(userContext.value); }); } addLoadEvent(AutoCompleteContextKeys); ... <asp:TextBox runat="server" ID="edtState" CssClass="EditBox" Width="350px" /> <ajax:AutoCompleteExtender ID="autoCompleteState" runat="server" ServiceMethod="State" ServicePath="../../API/AutoComplete.asmx" TargetControlID="edtState" MinimumPrefixLength="1" CompletionInterval="250" EnableCaching="true" CompletionSetCount="20" FirstRowSelected="true" UseContextKey="true" CompletionListCssClass="AutoComplete_List ACL_Width200" CompletionListItemCssClass="AutoComplete_Item" CompletionListHighlightedItemCssClass="AutoComplete_ItemSelected"></ajax:AutoCompleteExtender> <asp:TextBox runat="server" ID="edtCountry" CssClass="EditBox" Width="350px" />
Both autoComplete and autoComplete2 are null.
What am I doing wrong?
SangNaga
Member
19 Points
12 Posts
Re: Adding Textbox-Value to ContextKey of Autocomplete control
Mar 29, 2010 06:04 PM|LINK
I need to have the contextKey determined by a TextBox. I am trying the approach by kirtid.
function AutoCompleteContextKeys() { var autoComplete = $find('autoCompleteState'); var autoComplete2 = document.getElementById('<%= this.autoCompleteState.ClientID %>'); if (autoComplete == null) alert("autoComplete is null"); if (autoComplete2 == null) alert("autoComplete2 is null"); if (!autoComplete) return; var target = autoComplete.get_element(); if (!target) return; var userContext = $get('edtCountry'); if (!userContext) return; // Dynamically assign the context autoComplete.add_populating( function() { autoComplete.set_contextKey(userContext.value); }); } addLoadEvent(AutoCompleteContextKeys); ... <asp:TextBox runat="server" ID="edtState" CssClass="EditBox" Width="350px" /> <ajax:AutoCompleteExtender ID="autoCompleteState" runat="server" ServiceMethod="State" ServicePath="../../API/AutoComplete.asmx" TargetControlID="edtState" MinimumPrefixLength="1" CompletionInterval="250" EnableCaching="true" CompletionSetCount="20" FirstRowSelected="true" UseContextKey="true" CompletionListCssClass="AutoComplete_List ACL_Width200" CompletionListItemCssClass="AutoComplete_Item" CompletionListHighlightedItemCssClass="AutoComplete_ItemSelected"></ajax:AutoCompleteExtender> <asp:TextBox runat="server" ID="edtCountry" CssClass="EditBox" Width="350px" />