Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In my application I am using the gridview in that I am using the check box. While binding the data into the gridview I want to unselect all the check boxes. Can any one help me to solve this problem.

Thanks
Posted

C#
//you can do as below

protected void gridview_RowDataBound(object sender, GridViewRowEventArgs e)
             {
                 if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chk = (CheckBox)e.Row.FindControl("chktest");
                    chk.Checked = false;
                }
             }

mark as solution if its what you are finding
 
Share this answer
 
In row_databound event you need to use findcontrol() method to search checkboxes in gridviewrow and then uncheck them.
OR you can use following code.
C#
(row.Cells[CheckBoxColumn.Index] as DataGridViewCheckBoxCell).value = false;
 
Share this answer
 
What value are you binding the checkbox column to??

If it is a bool then ensure that all values are set to false in the data source.

If you are not binding any value then ensure that you have set the Checked="False" in the checkboxes markup.

HTH!

Dinesh

Mark as solution if this solved your problem!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900