
April 11th, 2003, 02:02 PM
|
|
Registered User
|
|
Join Date: Mar 2003
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Getting the Selection From the DropDownList
I'm trying to get the value of the selection from the databound dropdownlist to be displayed in a textbox. <br>I have set the Autopostback property to true <br><br>However, the value that is displayed is always the first value from the database or rather the selected value is always the first value of the dropdownlist. <br><br>Here is the VB code:<br><br>Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load <br>OleDbDataAdapter1.Fill(DataSet11) <br>DropDownList1.DataBind() <br><br>End Sub <br><br>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click <br><br>End Sub <br><br>Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged <br>Dim str As String <br><br>str = DropDownList1.SelectedItem.Text <br><br>TextBox4.Text = str <br><br>End Sub <br>End Class <br><br>Please Help. Any assistance will be very much appreciated
|