I am using this code to select multiple checkbox in GridView
in asp.net
but it is not working
protected void cbheader_CheckedChanged(object sender, EventArgs e)
{
foreach (GridViewRow gridViewRow in GridView1.Rows)
{
((CheckBox)gridViewRow.FindControl("chkcol"))
.Checked = ((CheckBox)sender).Checked;
}
}
For me it is a nonsense to do a postback (generating traffic) only to check few checkboxes... IMHO it is better to use javascript.
Here there are some examples: multiple checkboxes inside a GridView q using jquery , checkbox as template column and last one
Try JavaScript to check all checkboxes in DataGrid. Postback requests is not a good idea to solve this. There is a good example of how to implement such functionality using JavaScript: Implement check all checkbox functionality in ASP.Net GridView control using JavaScript
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.