Click here to Skip to main content
15,895,462 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a gridview...i bind checkbox in gridview make its visible false...now in gridview_rowdatabound i want to make visible true some checkboxes...but all the checkboxes are becoming truw...how to do it?please help me out...
Posted
Comments
Prasad Avunoori 10-Feb-14 1:25am    
Please share your code.

1 solution

Try like this

C#
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
       {
           if (e.Row.RowType == DataControlRowType.DataRow)
           {
               CheckBox chk = e.Row.FindControl("CheckBoxID") as CheckBox;
               string someValue = DataBinder.Eval(e.Row.DataItem, "SomeCOlumn").ToString();
               chk.Checked = false;
               if (someValue == "someCheck")
               {
                   chk.Checked = true;
               }
           }
       }
 
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