Find Checkbox Control inside gridview in C#

By bryan tugade

We can find checkbox inside gridview by using Findcontrol.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;

partial class Default4 : System.Web.UI.Page
{

protected void Page_Load(object sender, System.EventArgs e)
{

for (int i = 0; i <= GridView1.Rows.Count - 1; i++) {
CheckBox iCheckbox = (CheckBox)GridView1.Rows(i).FindControl("Checkbox1");
iCheckbox.Checked = false;
}

}
}

Related FAQs

In C#, we can select and deselect checkbox in gridview in onPostback event of checkbox in gridview header.
Find Checkbox Control inside gridview in C#  (1307 Views)