can i bind textbox like dropdownlist means in dropdownlist we can set datatextfield to show text and datavaluefield to insert value into database.
i have to do using textbox,I have add extender to textbox Autocompletetype then to show user i am fetching Student Names but on click of button i have to insert id of student into the database.How can i do any idea regarding this.
If you are using the ASP.net auto complete extender you can use a hidden field to save the value from the autocomplete extender eventargs and the textbox to display the value. You need to register a OnClientItemSelected
callback attribute on the AutoCompleteExtender in your aspx page and then create a javascript function to set the value:
function SelectAutoCompleteValue(source, eventArgs) {
var hiddenFieldID = source.get_element().id.replace('tb', 'hf');
$get(hiddenFieldID).value = eventArgs.get_value();
}
Using this hidden field value you can save it to the database.