Hello,
I am using ASP.NET 3.5...I have a text box where I am using the AutoCompleteExtender for search.
When user enter the key the serach shows the "ProjectNumber-ProjectName" in the search result....after selecting any of this...only ProjectNumber is entered in the textbox (I am using hidden control to store key values)...everything works fine till here.
Now I have a problem with values stored in the hidden control...for example in the text box there are three ProjectNumbers ..A,B,C....now I go ahead and delete all these three and enter the key word again...the search work fine but when I select any value the Text box is populated with old value (coming from hidden control) like A,B,C and then new value D
Please suggest me how I can assign the hidden text box value with the new text box values after the selection is done...
function KeySelected(source, eventArgs) {
var labelVal = document.getElementById('<%=this.Hidden1.ClientID%>').value;
var userValues = "";
if (labelVal == "") {
userValues = eventArgs.get_value();
}
else {
userValues = labelVal + "," + eventArgs.get_value();
}
document.getElementById('<%=this.Hidden1.ClientID%>').value = userValues;
//Assigning the hidden value to text box
document.getElementById('<%=this.TxtProject.ClientID%>').value = userValues;
}
<
asp:textbox id="TxtProject" runat="server" Width="246px" MaxLength="100" ></asp:textbox>*<FONT face="Arial" size="2">Any text Separated by comma will give separate results</FONT> </TD>
<asp:AutoCompleteExtender ID="TxtProject_AutoCompleteExtender" runat="server" DelimiterCharacters="," MinimumPrefixLength="1" Enabled="True" ServicePath="AutoCompleteWebServices.asmx" OnClientItemSelected="KeySelected" CompletionListItemCssClass="ac_listItem" CompletionListHighlightedItemCssClass="ac_hl_listitem"
ServiceMethod="GetProjectList" TargetControlID="TxtProject" >
</asp:AutoCompleteExtender>