Home All Groups Group Topic Archive Search About

Making an entire column visible/not visible.

Author
13 Nov 2007 2:32 PM
Mufasa
How can I programatically change whether a column is visible/not visible in
a DataGrid?

TIA - Jeff.

Author
13 Nov 2007 2:59 PM
Eliyahu Goldin
You need to do it for every item in ItemDataBound event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Show quoteHide quote
"Mufasa" <j*@nowhere.com> wrote in message
news:eetoXIgJIHA.4272@TK2MSFTNGP06.phx.gbl...
> How can I programatically change whether a column is visible/not visible
> in a DataGrid?
>
> TIA - Jeff.
>
>
Author
13 Nov 2007 4:34 PM
Mufasa
Will that make the item in the row visible/invisible or the entire column
invisible? I want to be able to have a complete column (header included)
appear/not appear.

Show quoteHide quote
"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldD***@mMvVpPsS.org> wrote in
message news:%23cm4qXgJIHA.4584@TK2MSFTNGP03.phx.gbl...
> You need to do it for every item in ItemDataBound event.
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Mufasa" <j*@nowhere.com> wrote in message
> news:eetoXIgJIHA.4272@TK2MSFTNGP06.phx.gbl...
>> How can I programatically change whether a column is visible/not visible
>> in a DataGrid?
>>
>> TIA - Jeff.
>>
>>
>
>
Author
13 Nov 2007 4:54 PM
Eliyahu Goldin
ItemDataBound event fires for every item (row) including header and footer.
You will need to locate in the item the cell that belongs to the required
column and hide it like

e.Item.Cells[i].Visible = false;

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Show quoteHide quote
"Mufasa" <j*@nowhere.com> wrote in message
news:e4KweMhJIHA.5624@TK2MSFTNGP04.phx.gbl...
> Will that make the item in the row visible/invisible or the entire column
> invisible? I want to be able to have a complete column (header included)
> appear/not appear.
>
> "Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldD***@mMvVpPsS.org> wrote in
> message news:%23cm4qXgJIHA.4584@TK2MSFTNGP03.phx.gbl...
>> You need to do it for every item in ItemDataBound event.
>>
>> --
>> Eliyahu Goldin,
>> Software Developer
>> Microsoft MVP [ASP.NET]
>> http://msmvps.com/blogs/egoldin
>> http://usableasp.net
>>
>>
>> "Mufasa" <j*@nowhere.com> wrote in message
>> news:eetoXIgJIHA.4272@TK2MSFTNGP06.phx.gbl...
>>> How can I programatically change whether a column is visible/not visible
>>> in a DataGrid?
>>>
>>> TIA - Jeff.
>>>
>>>
>>
>>
>
>
Author
17 Nov 2007 6:43 PM
Riki
> "Mufasa" <j*@nowhere.com> wrote in message
> news:eetoXIgJIHA.4272@TK2MSFTNGP06.phx.gbl...
>> How can I programatically change whether a column is visible/not
>> visible in a DataGrid?
>> TIA - Jeff.

Eliyahu Goldin wrote:
> You need to do it for every item in ItemDataBound event.

That is not true.

You can set
DataGrid1.Columns(i).Visible=True

--

Riki