tags:

views:

70

answers:

2

I have an ajax autocomplete extender. I want to pass the value of the hidden field to the web service. I want to pass the value of the hidden field as contextkey parameter to the web service.

A: 

I figured it out. I have posted the code below in case some one else has a similar issue.

<label>Enter Client Last Name/First Name/Full Name/SSN: </label>
 <asp:TextBox ID="txtSearch" runat="server" MaxLength="20" autocomplete="off"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" SkinID="smallButton" OnClick="BtnSearchClick"
    OnClientClick="return RedirectPage();" Text="Search" />
    <input type="hidden" id="searchClient" runat="server" />
    <asp:TextBox ID="searchClient22" runat="server" MaxLength="20" autocomplete="off" Visible="false"></asp:TextBox>
     <ajaxToolkit:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="txtSearch" BehaviorID="AutoCompleteBehavior" 
    ServiceMethod="GetClients" ServicePath="~/AjaxServices/TickerSearch.asmx"
    MinimumPrefixLength="1" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="200"
    CompletionListCssClass="autocomplete_completionListElement menuList" CompletionListItemCssClass="autocomplete_listItem"
    CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=""
    ShowOnlyCurrentWordInCompletionListItem="true">
</ajaxToolkit:AutoCompleteExtender>

function pageLoad() { var autoComplete = $find('AutoCompleteBehavior'); if (!autoComplete) return; var target = autoComplete.get_element(); if (!target) return; var userContext = document.getElementById('').value; if (!userContext) return; // Dynamically assign the context and change the color when processing autoComplete.add_populating(function() { autoComplete.set_contextKey(userContext); }); }
Prashant
A: 

$find('AutoCompleteBehavior') returns null in .NET 4.0... any work around for that???

Borik

related questions