Marek Ruszczyk
Marek Ruszczyk

Reputation: 100

How to hide datagrid column in designer

I don't know how to hide column in datagrid in designer. Could anyone help me? I know that I can do it from code, but is it possible without code behind?

I already try with TableStyles but it doesn't work.

Here is my datagrid configuration: https://i.sstatic.net/pzSRe.png and my BindingSource https://i.sstatic.net/uh8bG.png

What I am doing wrong?

Thanks, Marek

Upvotes: 1

Views: 185

Answers (1)

Vishal
Vishal

Reputation: 2017

Try this in designer:

  • If you want to toggle between hiding a column and showing a column at design time, you only need to add the DataGridTableStyle once.

  • To show the column, set the Width property of GridColumnsStyles to a nonzero value. for example:

    DataGrid1.TableStyles("Products").GridColumnStyles("Quantity").Width = 100

Upvotes: 2

Related Questions