select all checkboxs in gridview

Posted by Srinu0411 under ASP.NET AJAX on 11/25/2009 | Views : 1574 | Status : [Member] | Replies : 2
hi
i want to know select all and select none checkbox in gridview please help me.

kaja srinivas


Responses

Posted by: Abhijit Jana on: 11/25/2009 [Member] [MVP] Bronze

Up
0
Down
I guess You are exactly looking for this :
http://www.codeproject.com/KB/webforms/SelectingAllCheckBoxes.aspx

Cheers !
Abhijit

Srinu0411, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 11/26/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day Srinu0411

Most of time this is done this way. You bind a Grid with an ID but hide it on Rowdatabound and to Check if the Record has been Checked

 //Loop through out the grid 

foreach (GridViewRow row in GridView2.Rows)
{
//Lets look for the ID's of the Checked Records
CheckBox chkbx = (CheckBox)row.FindControl("CheckBox1");


//Only Look for the Checked Records
if (chkbx != null && chkbx.Checked)
{
//Do what ever with the Checked Records
}
}


for non Checked records it the Opposite. Another Option is the link provided by Abhijit Jana

Thank you for posting at Dotnetfunda

Vuyiswa Maseko





Thank you for posting at Dotnetfunda
[Administrator]

Srinu0411, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response