How to show warning message if the entered item is not in autocomplete extender list

Posted by Bhanubysani under ASP.NET on 4/10/2013 | Points: 10 | Views : 2576 | Status : [Member] | Replies : 1
Hi All,

I am using Jquery model popup extender in my application.There are 3 text boxes car make,car model and car sub model these three are auto complete extenders.When i am selecting BMW which is coming in auto complete extender corresponding items will come in car model based on the item selected in car model car sub model will come.My issue is after selecting user is modifying his search, i mean suppose BMW is selected he adding some extra text to BMW so the corresponding items will not come.

so user is entering his own text.i need to restrict the items which are not in list,because the data is master data.Actually in text change event i am passing the first text box data as input parameter i am fetching the data, i am looping the data set and separating with commas and giving that as input to hidden field.
after that i am using jquery to handle auto complete extender.

function CarMakeAComplete() {
var MakeautocompleteVal = document.getElementById('<%=carautocomplete.ClientID %>').value.split(",");

// $(document.getElementById('<%=txtCarMake.ClientID %>')).autocomplete({ source: MakeautocompleteVal }),
$('#<%=txtCarMake.ClientID %>').autocomplete({ source: MakeautocompleteVal ,
select: function (event, ui) {
$('#<%=txtCarMake.ClientID %>').val(ui.item.value);

__doPostBack('<%=txtCarMake.ClientID %>', 'txtCarMake_TextChanged');


<asp:TextBox ID="txtCarMake" runat="server" CssClass="controls" AutoPostBack="true"
EnableViewState="true" onfocus="CarMakeAComplete();" OnTextChanged="txtCarMake_TextChanged"></asp:TextBox>
<span style="display: none">
<input type="text" id="carautocomplete" runat="server" />
<asp:TextBox ID="txtCarModel" runat="server" CssClass="controls" AutoPostBack="true"
EnableViewState="true" onfocus="CarModelAComplete();" OnTextChanged="txtCarModel_TextChanged"></asp:TextBox>
<span style="display: none">
<input type="text" id="modelautocomplete" runat="server" />

Please help me to resolve the issue.

Bhanu Prakash Bysani


Posted by: Jitendrasoft09 on: 4/10/2013 [Member] [MVP] Starter | Points: 25

You have to validate keypress event of javascript mapped to list item to allow to enter the value as per the list item only not the other value.
Plz refer below link that would be helpful-

Jitendra Kumar
If my post helps you, plz mark as an answer.

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response