Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop down list does not fire selectedindexchanged

Status
Not open for further replies.

llmclaughlin

Programmer
Aug 20, 2004
140
US
Not sure why this happening. I have a drop down list that I fill. I pick something from it which fills another drop down list. When I change the second drop down list the autopostback fires but the selectedindexchanged function does not on ddlFIELD1. Below is the code behind.


Private Sub ddlVALIDATION_POINT1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlVALIDATION_POINT1.SelectedIndexChanged

Dim oGetFieldDesc As New clsFUNC_EXPECTEDRESULTS
Dim dbTABLE As New DataTable
dbTABLE = oGetFieldDesc.GetValFieldDesc(Me.ddlVALIDATION_POINT1.SelectedValue.ToString)

Me.txtVAL_POINT.Text = Me.ddlVALIDATION_POINT1.SelectedItem.Text
Me.ddlVALIDATION_POINT1.Visible = False
Me.txtVAL_POINT.Visible = True
Me.txtVAL_POINT.ReadOnly = True

'Me.ddlFIELD1.Items.Clear()
Me.ddlFIELD1.DataSource = dbTABLE
Me.ddlFIELD1.DataTextField = "DDLTEXT"
Me.ddlFIELD1.DataValueField = "DDLVALUE"
Me.ddlFIELD1.DataBind()


HTML side

<td width="150"><asp:DropDownList id="ddlVALIDATION_POINT1" RUNAT="SERVER" autopostback="True"></asp:DropDownList><asp:TextBox id="txtVAL_POINT" runat="server" Width="150PX" Visible="FALSE"></asp:TextBox></td>
<td><asp:DropDownList id="ddlFIELD1" RUNAT="SERVER" AutoPostBack="true"><asp:ListItem>-- Please Select --</asp:ListItem></asp:DropDownList><asp:TextBox id="txtFIELD1" runat="server" Width="75" Visible="false"></asp:TextBox></td>

Any suggestions

Thanks

Louie
 
I am not sure what you are saying. If changed ddl2's value, ddl1's selectedindexchanged event won't fire.
 
What I'm saying is after I pick a value from ddlVALIDATION_POINT1,
i use the dbTABLE = oGetFieldDesc.GetValFieldDesc(Me.ddlVALIDATION_POINT1.SelectedValue.ToString) to fill the second ddl which is ddlFIELD1. The selectedindexchanged fires now for ddlFIELD1, but it always getting the first value in the list not the selected item.

Louie
 
Do you have a page load event perhaps that is resetting the combo box on postback?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top