|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Making an entire column visible/not visible.How can I programatically change whether a column is visible/not visible in
a DataGrid? TIA - Jeff. You need to do it for every item in ItemDataBound event.
-- Show quoteHide quoteEliyahu 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. > > 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. >> >> > > 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; -- Show quoteHide quoteEliyahu Goldin, Software Developer Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net "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. >>> >>> >> >> > > > "Mufasa" <j*@nowhere.com> wrote in message Eliyahu Goldin wrote:> news:eetoXIgJIHA.4272@TK2MSFTNGP06.phx.gbl... >> How can I programatically change whether a column is visible/not >> visible in a DataGrid? >> TIA - Jeff. > You need to do it for every item in ItemDataBound event. That is not true.You can set DataGrid1.Columns(i).Visible=True -- Riki
Why Does This Not Work?
Datagrid default date format Reload/refresh data in datagrid wrap text in datagrid cell wrapping text in datagrid Programattically setting gridview to edit mode GridView - Hyperlink Hiding grid columns based on some value in row DataView Borders Editing/Deleting/Inserting Records using ASPxGridView |
|||||||||||||||||||||||