MVCGrid.Net
MVCGrid.Net copied to clipboard
How to exclude column from export
I need to exclude particular column from export like csv file. Currently there is no any configuration exists. Please help me.
I have implemented some stuff by using reflections to exclude particular column from extract like csv, tsv etc. Soon I will commit the changes. If any one wants email me [email protected]
For code changes please go to https://pratikdhavale.wordpress.com/2017/12/24/mvcgrid-net-exclude-column-from-export/. Suggestions always welcome. Please reply me if you have any queries.
I had the same issue, I replaced the original export rendering with a custom one before I started.
So I just named the columns I wanted to exclude with a name starting with Action, set the Header text to anything you want.
.RemoveRenderingEngine("export") .AddRenderingEngine("export", typeof(TabDelimitedRenderingEngine)) .WithAuthorizationType(AuthorizationType.AllowAnonymous) .AddColumns(cols => { cols.Add("Action1").WithHeaderText("")
Then on the RenderingEngine, I excluded any column that started with the word Action
Thanks @anlebu, great solution. You save me many work ;)