Hi Guys,
I am setting a RadGrid column's visibility to false on a toolbar button press, and then back to true again when they press it again(a toggle). The problem I am having is that when I toggle the column invisible, it doesn't become visible again on the next toggle. I am just setting the Visible property of the column and I'm not sure why this is happening.
Here's what's going on in the code on the button click event:
I am setting a RadGrid column's visibility to false on a toolbar button press, and then back to true again when they press it again(a toggle). The problem I am having is that when I toggle the column invisible, it doesn't become visible again on the next toggle. I am just setting the Visible property of the column and I'm not sure why this is happening.
Here's what's going on in the code on the button click event:
else if (e.Item.Value.Substring(0, 2).Equals("CC")) | |
{ | |
bool hide = true; | |
string[] colDel = e.Item.Value.Split(delimiterChars); | |
string colName = colDel[1]; | |
RadToolBarButton mybut = (RadToolBarButton)e.Item; | |
if (mybut.Checked) | |
{ | |
mybut.Checked = false; | |
mybut.ImageUrl = ""; | |
hide = true; | |
} | |
else | |
{ | |
mybut.Checked = true; | |
mybut.ImageUrl = "/Images/Toolbar/update.gif"; | |
hide = false; | |
} | |
foreach (GridColumn rc in rgAcct.MasterTableView.Columns) | |
{ | |
if (rc.HeaderText.Equals(colName)) | |
{ | |
if (hide) | |
{ rc.Visible = false; } | |
else | |
{ rc.Visible = true; } | |
break; | |
} | |
} | |
foreach (GridColumn rc in rgAcct.MasterTableView.AutoGeneratedColumns) | |
{ | |
if (rc.HeaderText.Equals(colName)) | |
{ | |
if (hide) | |
{ rc.Visible = false; } | |
else | |
{ rc.Visible = true; } | |
break; | |
} | |
} | |
} |