Thursday, June 30, 2011

How will you check all the checkboxes in a Grid ?



Can be done using javascript or code-behind(server code)

1. in javascript, access the gridview and then iterate through all child elements of type "checkbox".
then set the check if not already set using item.click.
http://www.codedigest.com/Articles/ASPNET/132_GridView_with_CheckBox_%e2%80%93_Select_All_and_Highlight_Selected_Row.aspx
using jquery this is simpler :
http://www.codedigest.com/CodeDigest/62-Check-All-Checkboxes-in-GridView-using-JQuery.aspx

2. in the code behind use the DataRowBind method to check all the check boxes, accessing cells of the row, then identifying cell type of checkbox and then call clickon each item
(to be verified)

No comments:

Post a Comment

How to check local and global angular versions

 Use the command ng version (or ng v ) to find the version of Angular CLI in the current folder. Run it outside of the Angular project, to f...