Thursday, September 16, 2010

Header column Text in Datagrid

http://www.codeproject.com/KB/webforms/Datagrid_Col_Example.aspx
private void HideShowColumns(DataGrid dg)
{
if(dg == null)
{
return;
}
// Loop through all of the columns in the grid.

foreach(DataGridColumn col in dg.Columns)
{
// Hide the Salary and SS# Columns.

if(col.HeaderText == "ExampleColumn")
{
col.Visible = false;
}
}
}

No comments: