Click here to Skip to main content
15,889,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I have a gridview Under update panel. I placed HTML input checkbox in my Item template. Now i want to find this checkbox id in gridview page Index changing event. I am uanble find always its shows null object.

I user like this code in gridview page index. I tried serveral ways, but not geeting the id of checkbox.

foreach (GridViewRow row in mygrid.rows)
{
HtmlInputCheckBox chk = (HtmlInputCheckBox)row.FindControl("chkBulk"); // Null reference
CheckBox chk = (CheckBox)(row.Cells[0].FindControl("chkBulk")); // null reference
}

There is no runat="server" in check box control. I don't require that,
<itemtemplate>
<input id="chkBulk" type="Checkbox" class="Single" önClick="SetRowColor(this)"/>


I need only input check box for my Jquery functions. Now I need to find weather this input checkbox checked or not.

Please help in this issue.
Posted
Updated 17-Jul-14 20:41pm
v3
Comments
Thanks7872 18-Jul-14 2:41am    
It clearly says that runat server. Without that tag control won't be accessible at server side. You can use some client side methods to get it.

1 solution

yes, you should use runat=server
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900