DropDownList in GridView column no declared in Button_Click

J

James

I have a GridView where I have added a DropDownList control that is bound to
a field in the GridView.

I want to be able to set the dropdown for each row in the gridview then
update the rows on the submit (button_click).

I have the following code for the button_click. The problem I'm having is
that "DropDownListSeries" is not declared. I need to know how to use that in
the button_click function.

Any help would be GREATLY appreciated!

Imports System.Data.SqlClient

Partial Class members_members_lineups

Inherits System.Web.UI.Page





Protected Sub ButtonSubmit_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ButtonSubmit.Click

Dim driverID As Integer

Dim teamID As Integer

Dim Series As String



Dim row As GridViewRow

For Each row In GridViewLineup.Rows

driverID = row.Cells(4).Text

teamID = row.Cells(5).Text

Series = DropDownListSeries.SelectedValue

Dim sql = "UPDATE tblRosters SET series='" & Series & "' WHERE driverID=" &
driverID

SqlDataSource_Rosters.UpdateCommand = sql

SqlDataSource_Rosters.Update()

Next

GridViewLineup.DataBind()

End Sub



End Class
 
J

James

I figured it out:

Dim ddl As DropDownList
ddl = row.FindControl("DropDownList_Series")
series = ddl.SelectedValue
 

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,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top