I want to checked value of Checkbox in GridView if any rows is null then next GridView can’t show.
//Checkbox GridView1
foreach (GridViewRow rowItem in GridView1.Rows)
{
CheckBox chk = (CheckBox)(rowItem.Cells[4].FindControl("chkSelected1"));
if (chk.Checked == false)
{
GridView2.Visible.Equals(false);
break;
}
else
{
GridView2.Visible.Equals(true);
}
}
You need to assign false to the visible property. Currently you are comparing it, if it equals false. Do it like:
Your current code returns a
boolvalue, it doesn’t set the Visible property of the gridviewThe above line from your code compares if the
GridView2.Visibleproperty is set to false. It doesn’t update theVisibleproperty of the gridview.Similarly to make the Grid View visible set it to true like: