How to hide a column in datagrid

What I’m trying to do:
I want to show/hide a column in datagrid at runtime based on some input. Is there anyway to do this. (Note I have already created the column, i just want to hide it)

What I’ve tried and what’s not working:
Look through the documentation. Didn’t find anything or perhaps I am missing something.

Hi @ehsensiraj,

Check out this section of the docs on showing and hiding rows and columns in a DataGrid. Hopefully this helps solve your problem :slight_smile:

3 Likes

I followed doc and can show/hide column successful.
Howevery, if I add a component such as label to datarow for binding data, this will not work like expect.
The label till show as the last column.

Can you show me how to hide the label too?

I think you’re looking for the label’s visible property. You can set it to False to hide the label.