Show and hide the columns in datagrid


In my page have a selection for iteration of parameters 1 to 20. In the datagrid if user select iteration at 3. The datagrid show column "iteration 1", "iteration 2", "iteration 3". and hide other 4 to 20. If user select iteration 2 then show 1, 2 iteration colume, hide others. But at least have 1 iteration selected. I am bind this datagrid with datatable. The expand collapse column is unsupport. What is best way to do this in css? Any example code I can follow?



This can be easily achieved using the visible property of the datagrid component.

<RadzenDataGridColumn TItem="YourItem" Property="YourProperty" Title="YourTitle" Visible=@(Iteration<=YourColumnNumber) />

Where Iteration is the variable to store iteration number as per user selection and YourColumnNumber will be the column number from 2 to 20