I am working on this problem a couple of days, I did not get solution.

in my web page , there is a gridview with a checkbox templatefield
I need to know if checkbox is checked, I use following way, Even though I saw the checkbox is checked, I get checkbox.check is false.



Dim index As Integer
For Each gvrow As GridViewRow In GridView1.Rows

index = gvrow.RowIndex
Dim cb As CheckBox = DirectCast(gvrow.Cells(0).FindControl("Sel"), CheckBox)

'Dim cb As CheckBox = CType(gvrow.FindControl("Sel"), CheckBox)
'Dim cb As CheckBox = CType(gridview1.row(index).FindControl("Sel"), CheckBox)


If cb.Checked Then ' Here I got cb.checked=false
Do something
End If
Next
my gridview defination:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
OnRowUpdated="GridView1_RowUpdated" OnRowEditing="GridView1_RowEditing"
OnRowCommand="GridView1_RowCommand" OnRowCancelingEdit="GridView1_RowCancelingEdit"
DataKeyNames="Itemcode" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
>
<Columns>

<asp:TemplateField HeaderText="Sel">
<ItemTemplate>
<asp:CheckBox ID="Sel" Width=5px runat="Server" Enabled =true
EnableViewState =true />
</ItemTemplate>
<ItemStyle Width="8px" />
</asp:TemplateField>
<asp:BoundField DataField="ItemCode" HeaderText="ItemCode" >
<ItemStyle Width="40px" />
</asp:BoundField>
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="Category" HeaderText="Category" SortExpression="Category" />
<asp:BoundField DataField="UOM" HeaderText="UOM" SortExpression="UOM" />
<asp:BoundField DataField="UnitPrice" HeaderText="Unit Price" SortExpression="UnitPrice" />
<asp:BoundField DataField="UPC" HeaderText="UPC" SortExpression="UPC" />
<asp:BoundField DataField="SKU" HeaderText="Sku" SortExpression="SKU" />
<asp:BoundField DataField="NetWeight" HeaderText="NetWeight" SortExpression="NetWeight" />
<asp:BoundField DataField="Dimension_H" HeaderText="Dimension_h" SortExpression="Dimension_h" />
<asp:BoundField DataField="Dimension_L" HeaderText="Dimension_l" SortExpression="Dimension_l" />
<asp:BoundField DataField="Dimension_w" HeaderText="Dimension_w" SortExpression="Dimension_w" />
<asp:BoundField DataField="Min_Qty" HeaderText="Min_Qty" SortExpression="min_Qty" />
<asp:BoundField DataField="OrderUnit" HeaderText="OrderUnit" SortExpression="OrderUnit" />
</Columns>
</asp:GridView>
please tell me what's wrpng with my code.