T
TheDude5B
Hi,
I have created the Insert Template for my FormView on an aspx page
using asp.net 2.0. Inside this FormView I have some TextBox's and other
elements. One of these elements is a DropDownList which needs to be
populated from fields in a database.
So far I have the DropDownList bound to a function and the code is
simply:
<aspropDownList ID="ixFilm" runat="server"
DataSourceID="ObjectDataSource1" DataTextField="strTitle"
DataValueField="ixFilmID" >
</aspropDownList>
ObjectDataSource1 is linked to a .vb page which has the code for
selecting the data.
Firstly, how can I Bind the selected option from the DropDownList when
I want to insert data into a database?
Secondly, how can I put in an extra option into this DropDownList which
says "Please Select" ?
code in the .vb file is:
Public Overloads Function GetActiveFilmList() As Generic.List(Of
ActiveFilms)
Using connFilmList As New
SqlConnection(ConfigurationManager.ConnectionStrings("VUE_DMS_SQLConnectionString").ConnectionString)
Using cmdFilmList As New
SqlCommand("spCinemas_ListAllActiveFilms", connFilmList)
cmdFilmList.CommandType = CommandType.StoredProcedure
connFilmList.Open()
Dim list As New Generic.List(Of ActiveFilms)
Using drFilmList As SqlDataReader =
cmdFilmList.ExecuteReader()
Do While (drFilmList.Read())
Dim temp As New
ActiveFilms(CInt(drFilmList("ixFilmID")), CStr(drFilmList("strTitle")))
list.Add(temp)
Loop
End Using
Return list
End Using
End Using
End Function
Thanks..
I have created the Insert Template for my FormView on an aspx page
using asp.net 2.0. Inside this FormView I have some TextBox's and other
elements. One of these elements is a DropDownList which needs to be
populated from fields in a database.
So far I have the DropDownList bound to a function and the code is
simply:
<aspropDownList ID="ixFilm" runat="server"
DataSourceID="ObjectDataSource1" DataTextField="strTitle"
DataValueField="ixFilmID" >
</aspropDownList>
ObjectDataSource1 is linked to a .vb page which has the code for
selecting the data.
Firstly, how can I Bind the selected option from the DropDownList when
I want to insert data into a database?
Secondly, how can I put in an extra option into this DropDownList which
says "Please Select" ?
code in the .vb file is:
Public Overloads Function GetActiveFilmList() As Generic.List(Of
ActiveFilms)
Using connFilmList As New
SqlConnection(ConfigurationManager.ConnectionStrings("VUE_DMS_SQLConnectionString").ConnectionString)
Using cmdFilmList As New
SqlCommand("spCinemas_ListAllActiveFilms", connFilmList)
cmdFilmList.CommandType = CommandType.StoredProcedure
connFilmList.Open()
Dim list As New Generic.List(Of ActiveFilms)
Using drFilmList As SqlDataReader =
cmdFilmList.ExecuteReader()
Do While (drFilmList.Read())
Dim temp As New
ActiveFilms(CInt(drFilmList("ixFilmID")), CStr(drFilmList("strTitle")))
list.Add(temp)
Loop
End Using
Return list
End Using
End Using
End Function
Thanks..