Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can not store value of a row that is checked?

Status
Not open for further replies.

mimitan

Technical User
Dec 17, 2004
34
Greeting,
I have a gridview with checkbox that allow user to check to select and when the user is done selecting, he/she click on Submit button and will be send to a different page. below is the click event code

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim items As New System.Collections.Generic.List(Of String)

For Each row As GridViewRow In GridView2.Rows
Dim chk As CheckBox = TryCast(row.FindControl("CheckBox1"), CheckBox)

If chk.Checked Then
items.Add(row.Cells(0).Text)
items.Add(",")
End If
Next

Session("items") = items

End Sub

Session ("items") is supposed to store the value of cells(0) of selected rows. But nothing is stored.

Appreciate your help.
 
I am sorry.
I found out what my problem was.
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top