How to find the div inside the Gridview (outside of gridview function)
.aspx file
<div id=”tooltip” style=”display: none;”></div>
Code Behind file
Make hide of the div
foreach (GridViewRow row in gvdStatus.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
HtmlGenericControl dive = new HtmlGenericControl();
dive = ((HtmlGenericControl)(row.FindControl(“tooltip”)));
dive.Visible = false;
}
}
Applying color to the row based on the condition
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (Convert.ToInt32(e.Row.Cells
{
e.Row.BackColor = System.Drawing.Color.Blue;
}
}
Note :
A table can have header data or footer rows. The above statement will make sure that the row is data row.
row.RowType == DataControlRowType.DataRow: use it every time if you want to look for something in every row.
Leave A Comment