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_ItemDa taBound(object sender, DataGridItemEve ntArgs e)
{
if(e.Item.ItemT ype == ListItemType.It em || e.Item.ItemType ==
ListItemType.Al ternatingItem)
{
if(!ControlStat us)
{
//If ControlStatus is False, remove the LinkButton and Add a
Label
e.Item.Cells[1].Controls.Remov eAt(0);
Label labelItem = new Label();
labelItem.Text = "Text";
e.Item.Cells[1].Controls.Add(l abelItem);
}
}
}
"Rajesh.V" <Ra***********@ hotmail.com> wrote in message
news:OH******** *****@TK2MSFTNG P10.phx.gbl...
How about this?
MyDatagrid.Colu mns[0].Visible = false;
"CGuy" <cg**@csharp.ne t> wrote in message
news:OJ******** ******@TK2MSFTN GP09.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