BEEXTOPPOXY
New Member
Scenario:<BR>I am using the WEB Form 'DropDownList' control.<BR>Problem:<BR>when selecting the very first (or only!) item in the list; which is the one showing in the 'input' field. ---> the SelectedIndexChanged does NOT fire. <BR>any other item in the list works fine (!including the first one after selecting 'another' one first!)<BR>And yes: Potback is set to true!<BR>PS: I remember seeing same issue reported before but can't find it anymore.<BR>Thanks for a hint, ed <BR><BR> <BR><BR> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<BR> If Not IsPostBack Then<BR> ' bind DropDownPlayer<BR> DataSet11.Clear()<BR> SqlDataAdapter1.Fill(DataSet11, "Player")<BR> 'DropDownList1.DataSource = DataSet11.Tables("Player")<BR> DropDownList1.DataBind()<BR> End If<BR> End Sub<BR> Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged<BR> SqlDataAdapter2.SelectCommand.Parameters("@Key_PlayerID").Value = http://aspmessageboard.com/archive/index.php/DropDownList1.SelectedItem.Value<BR> SqlDataAdapter2.Fill(DataSet11, "Played")<BR> DataGrid1.DataBind()<BR> End Sub... I found part of the answer by talking to a collegue. There is obviously a certain (timely) learning curve. Therefore, in case others 'suffer' the same below hints might help saving time behind the tube<BR><BR>- whenever a DropDownList is 'bound' the 'DataValueField' is set with the first item in the list I.e. ready to work with. therefore, selecting same field does NOT fire 'selectedIndexChanged'<BR><BR>One question remains: Is there a technique to prevent setting the DataValueField for the 1st item? For certain cases I would prefer that!<BR>Thanks ed <BR><BR>mydropdown.Items.Insert(0, "< - - - - - Select - - - - - >")<BR>mydropdown.SelectedIndex = 0<BR><BR><BR>i do that, makes it so i can select everything i want to
Thanks a lot - it works<BR>brgds ed
