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