Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete autogenerated columns from Telerik RadGrid?

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

like image 937
IgorCh Avatar asked Dec 10 '25 01:12

IgorCh


2 Answers

link to telerik website

this is the documentation on how to do what you are trying to do.

or check Grid.MasterTableView.AutoGeneratedColums collection.

like image 60
gashach Avatar answered Dec 15 '25 05:12

gashach


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

like image 22
Pablo Claus Avatar answered Dec 15 '25 04:12

Pablo Claus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!