Introduction:In this article we will see how to check and uncheck all CheckBoxes present in an ASP.Net GridView control.Background: While programming many times we need to use a CheckBox control in an ASP.Net GridView for allowing selection of a particular row of a GridView. In some cases a GridView can contain 100 of records and if the user wants to select all rows of the GridView then selecting each row one by one is very tedious and a time-consuming job. To make it easier we will see how to write a simple method for selecting all CheckBoxes in a GridView. Take a look at the following snippets.
foreach (GridViewRow row in GridView1.Rows) { CheckBox chkcheck = (CheckBox)row.FindControl("chkid"); chkcheck.Checked = p; } }
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: