I have a gridview as such
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CrewId"
BorderStyle="None" GridLines="None" CellPadding="5" DataSourceID="SqlDataSource1">
<HeaderStyle CssClass="callBackHeader" />
<RowStyle CssClass="callBackRow" />
<AlternatingRowStyle BackColor="#EEEEEE" />
<Columns>
<asp:BoundField DataField="Name" SortExpression="Name" HeaderText="Send To" />
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="userCheck" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I'm trying to loop through it based on a query string. If the query string id matches the row id, then I want to set the checkbox to checked. Right now however, I'm just trying to output the row ID and I can't seem to get it. When I run this, it doesn't write anything. Any ideas why?
' Iterate through the Products.Rows property
For Each row As GridViewRow In GridView1.Rows
Response.Write(row.ID)
'' Access the CheckBox
'Dim cb As CheckBox = row.FindControl("userCheck")
If cb IsNot Nothing AndAlso cb.Checked Then
'Response.Write(row.ID)
' ' First, get the ProductID for the selected row
' Dim leadid As Integer = Convert.ToInt32(GridView1.DataKeys(row.RowIndex).Value)
' Dim sql = "UPDATE Leads SET CalledBack = 'yes' where LeadId = " & leadid
' MyFunctions.executeQuery(sql)
End If 'if cb is not nothing
Next 'for each row