.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Dynamic checkobx adding in GridView

Posted By: Ramesh     Posted Date: July 28, 2010    Points:2   Category :ASP.Net
I have added dynamic checkbox in the GridView

I want to check check box is checked or not

If I use objgridrowview.FindControl("Idname",CheckBox)

It shows me error like object reference is not set to instance of object

Author: Syed Shakeer Hussain             
Posted Date: July 28, 2010     Points: 5   

Hi Ramesh,
use the below code
protected void Gridview_Click(object sender, EventArgs e)


for (int i = 0; i < Gridview1.Rows.Count; i++)


CheckBox chkb = (CheckBox)Gridview1.Rows[i].Cells[0].FindControl("chk");

if (chkb.Checked)


string name = Gridview1.Rows[i].Cells[2].Text;

Response.Write("<br>" + name);




For more inforamtion you can check this article

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend