static public void HideGridviewColumns(GridView aGridView,ArrayList arrColumnName)
{
System.Web.UI.WebControls.BoundField DataColumn;
if (arrColumnName.Count > 0)
{
for (int Index = 0; Index < aGridView.Columns.Count; Index++)
{
DataColumn = aGridView.Columns[Index] as System.Web.UI.WebControls.BoundField;
if (DataColumn != null)
{
DataColumn.Visible = !arrColumnName.Contains(DataColumn.HeaderText);
}
}
}
else
{
for (int Index = 0; Index < aGridView.Columns.Count; Index++)
{
DataColumn = aGridView.Columns[Index] as System.Web.UI.WebControls.BoundField;
if (DataColumn != null)
{
DataColumn.Visible = false;
}
}
}
}
{
System.Web.UI.WebControls.BoundField DataColumn;
if (arrColumnName.Count > 0)
{
for (int Index = 0; Index < aGridView.Columns.Count; Index++)
{
DataColumn = aGridView.Columns[Index] as System.Web.UI.WebControls.BoundField;
if (DataColumn != null)
{
DataColumn.Visible = !arrColumnName.Contains(DataColumn.HeaderText);
}
}
}
else
{
for (int Index = 0; Index < aGridView.Columns.Count; Index++)
{
DataColumn = aGridView.Columns[Index] as System.Web.UI.WebControls.BoundField;
if (DataColumn != null)
{
DataColumn.Visible = false;
}
}
}
}
No comments:
Post a Comment