I am unable to access html checkbox on button click event.The checkbox is in gridview control.
<asp:GridView ID="_grvItems" runat="server" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<input type="checkbox" id="_chkSelect" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="pgr" />
</asp:GridView>
And I click on button then show me error "Object reference not set to an instance of an object." the code of button click event is :
for (int i = 0; i < _grvItems.Rows.Count; i++)
{
HtmlInputCheckBox ch = (HtmlInputCheckBox)_grvItems.Rows[i].FindControl("_chkSelect");
if (ch.Checked)
{
Response.Write("Checkbox is Checked");
}}