Is there any way to hide columns in the datagrid that are data bounded using C# coz I have realized that they are not references as columns maybe cells but then again I dont find visible property for the cells, U only get the text,

I tried to use this code but its also not working, it gives me error as I said before the columns bounded using C# arent considered as columns just like the ones that are bounded using HTML code behind files

dgItems.SelectedItem.Cells[4].Visible = false;

/*and then again I tried to do this but its not working too but its not giving me error but it doesnt give me the outoput I need at all*/

 foreach(DataGridColumn col in dgItems.Columns)
 {
        if (col.HeaderText == "PictureName")
           col.Visible = false;

 }

Any help

do you autogenerate the columns? is so, basically disable it and then create templated columns.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.