This is a migrated thread and some comments may be shown as answers.

Auto Complete textbox bind text and value

5 Answers 466 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Suraj
Top achievements
Rank 1
Suraj asked on 13 Oct 2013, 07:23 PM
Hi 
    i  have an auto complete text box i am able to  bind the the data to the text box  i  am able to  retrieve the value and store it in the database
No i want know how do i bind the the saved value  in the database to the to auto complete text box  again i tried somewhat like this 
         
AutoCompleteBoxEntry childNode = new AutoCompleteBoxEntry();
              childNode.Text = lblTeamLeaderName.Text;
            childNode.Value = lblTASKTEAM_ID.Text;
            txtusers.Entries.Add(childNode);

and
txtusers.Entries[0].Value = lblTASKTEAM_ID.Text;
                 txtusers.Entries[0].Text = lblTeamLeaderName.Text;


but still value which is saved  is not being shown in the textbox i want to bind the text and value some what like  dropdownlist box  can any one  tell where i am going wrong





5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 Oct 2013, 11:52 AM
Hi Suraj,

Can you explain a bit more about your scenario like what type of binding are you using?

Thanks,
Shinu.
0
Suraj
Top achievements
Rank 1
answered on 17 Oct 2013, 05:17 AM
 i a have one value in the databse as 2  now i want to   bind  this 2 to auto complete text box this two has master value say the city name
some what similar to  dropdownlist in asp.net
 how we bind the  like how we dolike this
ddl.clearselection();
ddl.items.findbyvalue("2").selected =true;
0
Bozhidar
Telerik team
answered on 21 Oct 2013, 10:25 AM
Hello Suraj,

RadAutoCompleteBox doesn't use the regular binding mechanism that the DropDownList does. It's actually never bound in the sense that you have access to its items on the server. Only when you type something in the textbox does it request and render the matched items, after which they are again lost. So you won't be able to do something like autoCompleteBox.Items..., because the items are not accessible. 

Instead you have to use the approach you pointed out in your first post - creating a new Entry manually and inserting it into the RadAutoCompleteBox. I've also attached a simple sample page demonstrating this approach.
 

Regards,
Bozhidar
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Suraj
Top achievements
Rank 1
answered on 22 Oct 2013, 04:54 AM
ok :)
0
Dell
Top achievements
Rank 1
answered on 24 Apr 2015, 06:52 AM

Try this one....simple and easy

http://net-informations.com/q/faq/autocomplete.html

Dell

 

Tags
AutoCompleteBox
Asked by
Suraj
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Suraj
Top achievements
Rank 1
Bozhidar
Telerik team
Dell
Top achievements
Rank 1
Share this question
or