Using Bound Drop Down Lists in FormView

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:

<asp:DropDownList ID="ixFilm" runat="server"
DataSourceID="ObjectDataSource1" DataTextField="strTitle"
DataValueField="ixFilmID" >
</asp:DropDownList>

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..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top