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

Misc Javascript points

 Nodejs can support multithreading through use of promises _ is the numeric separator for javascript, that means the numbers 10_000, 11.23_0...