Hide column in Gridview based on parent

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

In VS 2008:
If I have a user control that has a GridView, how do I hide a column from
one page and leave it visible when called from another?

Thanks,

Tom
 
I figured out how to figure out what the parent page is:

this.parent.title

But I can't figure out how to hide the column (in this case the left column)
if it is a particular page.

I tried to do:

protected void mGridView_RowCreated(object sender,
GridViewRowEventArgs e)
{
if (this.Page.Title != " Providers")
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].CssClass = "hiddencol";
}
else if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].CssClass = "hiddencol";
}
}
}

where hiddencol is:

..hiddencol
{
display:none;
}

But all that does is leave a white area where the column is. It doesn't
actually hide the column. All the color is gone but the gridlines are still
there.

Tom
 
Back
Top