I dynamically change columns for a RadGrid, for some data sources I need AutoGenerateColumns for other I don't. But after data binding with AutoGenerateColumns=True I tried to clear Columns list and add new, but old autogenerated columns still there. There is an example on VB.NET of code for adding new column
reportGrid.AutoGenerateColumns = False
reportGrid.Columns.Clear()
Dim column As New GridBoundColumn
column .DataField = "field1"
column .HeaderText = "header1"
reportGrid.Columns.Add(column)
Columns.Clear() doesn't remove autogenerated columns, how can I remove them?
Thanks
link to telerik website
this is the documentation on how to do what you are trying to do.
or check Grid.MasterTableView.AutoGeneratedColums collection.
According to telerik it is not possible to delete a Grid column which is already added in the Grid's Column collection. One suggestion will be to set its Visibile/Display property to false.
http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-removing-column-on-runtime.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With