DropDownlist

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

I would like to know why no DropDownList id value ?

Coding
-------

sub page_load()

Dim con As New
SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

Dim cmd As New SqlCommand()
cmd.CommandText = "Select gl_date,gl_date_value from gldate"
cmd.Connection = con

Try
con.Open()

Dim rd As SqlDataReader = cmd.ExecuteReader()

DropDownlist_Date.DataSource = rd
DropDownlist_Date.DataTextField = "gl_date"
DropDownlist_Date.DataValueField = "gl_date_value"
DropDownlist_Date.DataBind()

rd.Close()

Finally
con.Close()
End Try

End Sub

<asp:DropDownList id="DropDownlist_Date" runat="server"></asp:DropDownList>
 
example record in database via dropdownlist
1st record : 2001
2nd record : 2002
...
10th record : 2010

It always selected 1st record which it is 2001 although other selection is
made.

Why dropdownbliast value is alwasy point to 2001?
 
Back
Top