We help IT Professionals succeed at work.

how to create a search box in asp.net that will populate other fields in my form (form already created)

I'm trying to add a search box so that when user enters in a last name, the database will return a list (drop-down, etc) displaying all the users with the matching last name. Ex: search for 'king' and 19 records have last names that either start with king and/or = to king. Then once the desired record is selected, I need other fields in the form populated with the data from that field.
Watch Question

Perhaps make a gridview with all the "king" names, and then fill your form based on the SelectedValue?


sorry, i didn't explain to well... my db has about 10,000 users in it and I wanted to be able to search for them by last name and when i type in the last name, a list of all related names appears and then once i select a name, it will then populate some of the other fields on my form with related data. my main focus is to create the search box and have it so that when i select a user that the other fields in my form get populated with the corresponding field values for that record. Thanks
* Name Matcher
1. a TextBox to type names.
2. a Button to post back.
3. a DataSource to select (near) matching results using the TextBox as a ControlParemeter.
4. DataBind the DataSource in the Buttons Click event.
* Name Selector
5. a ListBox to display result of finding,  AutoPostback to submit selection.
6. a DataSource to select the related details using the listbox as a ControlParameter.
7. DataBind this in the SelectedIndexChanged event of the ListBox.
* Data Displayer
8. a FormView, or DetailsView, container to display the data from the DataSource.
Forced accept.

EE Admin

Explore More ContentExplore courses, solutions, and other research materials related to this topic.