I have an aspx page that has a listview. Within the listview I have a column named BADGEID. When inserting the BADGEID as a textbox with the below code, everything works properly:

<asp:TextBox ID="BADGE" runat="server" Text='<%# Bind("BadgeID") %>'

I need this to be a DropDownList and I changed the textbox above to the below:

<asp:DropDownList ID="BADGE" runat="server" DataSourceID="SqlDataSource2" DataTextField="BADGE" DataValueField="BADGE" />

The listbox contains the items I need but when I send the information, the item selected in the DropDownList is not sent to the database.

Please let me know what I am missing or doing wrong. This is the first aspx with a DropDownList I have ever created.

To save values selected from a DropDownList, you must use SelectedItem. This is how you use it:-

string insertCommand="insert into TableName values ('"+BADGE.SelectedItem.Text.ToString()+"')";

SqlCommand commandObject=new SqlCommand(insertCommand, connectionObject);

commandObject.ExecuteNonQuery();

Don't worry, we are all learners.

Which error you got? please give the details of error you are getting.