Re: issue when populating data in textbox on dropdownlist box

Re: issue when populating data in textbox on dropdownlist box

am 23.12.2007 04:55:52 von nothingsoriginalontheinternet

On Dec 18, 2:05 am, Dhananjay wrote:
> ...i have dropdownlist box on which i will select an item,
> based on this selection , i have another textboxforedit(this textbox
> will be populated with dropdownlist box selected item).
> in this textboxforedit i will modify the data and i have a update
> button,if i click update button, it should be updated in the table.

This is nothing complicated, I'm assuming you are trying to use a
DropDownList to prefill a TextBox so people don't have to type common
things.

What you need to do is create a DropDownList with the AutoPostBack
attribute set to True, and then handle it's SelectedIndexChanged event
to set the Text property to the value of the SelectedValue property of
the DropDownList:


Pre-typed things
...



Here's an outline of how you would handle the event:

Sub DropDownList1_SelectedIndexChanged(sender as object, ...)
Handles ...
TextBox1.Text = CType(sender, DropDownList).SelectedValue
End Sub

I'm not sure what you mean by updating the database, it's unstated
whether this is a new record or editing a record, if there is already
existing code that this will work alongside, etc. You will have to
explain your problem further.

-Michael Placentra II