Nope... that would make the whole column vanish!!!
My requirement is that based on a variable's value, the column should behave
like a ButtonColumn or a Bound Colummn.
I was able to find a solution myself. This is how I'm doing it.
private void DataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
if(!ControlStatus)
{
//If ControlStatus is False, remove the LinkButton and Add a
Label
e.Item.Cells[1].Controls.RemoveAt(0);
Label labelItem = new Label();
labelItem.Text = "Text";
e.Item.Cells[1].Controls.Add(labelItem);
}
}
}
"Rajesh.V" <Ra***********@hotmail.com> wrote in message
news:OH*************@TK2MSFTNGP10.phx.gbl...
How about this?
MyDatagrid.Columns[0].Visible = false;
"CGuy" <cg**@csharp.net> wrote in message
news:OJ**************@TK2MSFTNGP09.phx.gbl...
Hi,
I have a datagrid that has one ButtonColumn which is bound to a database field.
My requirement is that when the page containing the datagrid is
loaded, I would like the ButtonColumn to be enabled/disabled based on the value
of a boolean variable that is calculated at runtime - if the value if false,
I don't want the ButtonColumn to display links for the displayed items.
Please help me in doing this.
CGuy