I am developing an asp.net application in VB
In one of my forms I have a DropDownList called cboDiscount which is populated from SQL database and cboDiscount contains 14 items with appropriate values (0 or 5). It is set to AutoPostBack is set to True and has an associated event cboDiscount_SelectedIndexChanged.
Here is my problem:
When the first or second item (index 0 and 1) is selected the cboDiscount.selectedIndex is 0 or 1 appropriately.
However, when any item > 2 is selected (index > 1), within the event cboDiscount.SelectedIndex is always 1. The SelectedValue And SelectedItem.Text is also same as index 1.
Basically what I want to do is to retreive the Text and Value of the selected item.
As a note the DDL is only populated once.
This is the code where I populate the DDL:
sqlDr = sqlCmd.ExecuteReader()
cboName.Items.FindByText("None").Value = "0"
If Not IsDBNull(sqlDr.Item("1")) Then
cboName.Items.FindByText(sqlDr.Item("2")).Value = sqlDr.Item("Value")
This is the code for the event:
Private Sub cboDiscount_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboDiscount.SelectedIndexChanged
Dim intIndex As Integer = cboDiscount.SelectedIndex
txtDiscountAmt2.Text = cboDiscount.SelectedValue
txtDiscountType2.Text = cboDiscount.SelectedItem.Text
Any thoughts, ideas or similar problems?