I use autocompleteExtender to key into a textbox, the value will come from a database table.setting UseContextKey=true,and the ContextKey depend on dropdown control.
When I click the dropdown first,the value come from a database table is what I need.In the meanwhile,I found the dropdown value is wrong,I select another dropdown value,and enter same keyword into the textboxand,but the value come from a database still
show the privious value,not the correct value what I click the dropdown again.
For example,firstly,if the dropdown value is A,I enter keyword test into the textbox,the value what come from a database table is A1,but in the same time,I found the dropdown value should be B,I change the dropdown value is B,and I enter keyword test into
the textbox again,the value what come from a database table still is A1,not show the correct value B1.
I found the dropdown value should be B,I change the dropdown value is B,and I enter keyword test into the textbox again,the value what come from a database table still is A1,not show the correct value B1.
This is my wild guess without taking a look at your code. It seems like you are not refreshing the contextkey when textbox text is changed(use keypress event)
I try every method,it still can't work fine.I believe if I can clear the cache of the
TextBox1 control,maybe it will be perfect.
If I select DropDownList1 value,and I key the string A in the
Textbox1,the result is what I want. Next,I change DropDownList1 value,and I key the string A in the
Textbox1,the result will be wrong.the Autocomplete Textbox effects doesn't appear immediately.When I refresh the form,it will show the right result. It's so strange. anyway,Thank you..
Member
38 Points
163 Posts
Autocomplete Textbox Using Database Return Value in ASP.NET
Apr 02, 2014 09:54 PM|jeff.wenchai|LINK
Hi,
I use autocompleteExtender to key into a textbox, the value will come from a database table.setting UseContextKey=true,and the ContextKey depend on dropdown control.
When I click the dropdown first,the value come from a database table is what I need.In the meanwhile,I found the dropdown value is wrong,I select another dropdown value,and enter same keyword into the textboxand,but the value come from a database still show the privious value,not the correct value what I click the dropdown again.
For example,firstly,if the dropdown value is A,I enter keyword test into the textbox,the value what come from a database table is A1,but in the same time,I found the dropdown value should be B,I change the dropdown value is B,and I enter keyword test into the textbox again,the value what come from a database table still is A1,not show the correct value B1.
So,how to fix the code?Thanks.
Contributor
5590 Points
1297 Posts
Re: Autocomplete Textbox Using Database Return Value in ASP.NET
Apr 02, 2014 10:37 PM|dotnetzoom|LINK
This is my wild guess without taking a look at your code. It seems like you are not refreshing the contextkey when textbox text is changed(use keypress event)
Member
38 Points
163 Posts
Re: Autocomplete Textbox Using Database Return Value in ASP.NET
Apr 03, 2014 02:16 AM|jeff.wenchai|LINK
Hi,dotnetzoom
Thank you for your help.The following is my code
In codebehind,
Now,Modify the code to look like your method.But it can't work smart,Maybe you can test ,you will get same result.It's so strange but it's true.
Contributor
5590 Points
1297 Posts
Re: Autocomplete Textbox Using Database Return Value in ASP.NET
Apr 03, 2014 07:47 AM|dotnetzoom|LINK
Why don't you add the event in the page markup? I'm assuming on keyup would make a difference.
Member
38 Points
163 Posts
Re: Autocomplete Textbox Using Database Return Value in ASP.NET
Apr 17, 2014 05:25 AM|jeff.wenchai|LINK
Hi dotnetzoom:
I try every method,it still can't work fine.I believe if I can clear the cache of the TextBox1 control,maybe it will be perfect.
If I select DropDownList1 value,and I key the string A in the Textbox1,the result is what I want. Next,I change DropDownList1 value,and I key the string A in the Textbox1,the result will be wrong.the Autocomplete Textbox effects doesn't appear immediately.When I refresh the form,it will show the right result. It's so strange. anyway,Thank you..