This is a migrated thread and some comments may be shown as answers.

[Solved] Add/Remove Column

2 Answers 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 15 Apr 2008, 03:01 PM
I have a grid that has 6 columns on it by default.  I then allow the user to add/remove other columns at run time.  The add works well however if they add a column and then attempt to remove that column only the Header for the column actuall get removed.

Eaxmple the user selects a checkbox that adds State column to a grid.  I add the column, set the datafield and uniquename.  ReBind the grid and all is good.  The user the deselects the State checkbox so I attempt to remove the column by finding that column with the unique name, do a Remove (I have also tried getting column and using RemoveAt) and a rebind.  The header for State is now gone but all the actual rows are still populated with the state data.  If the then attempt to add State again a new column is created with the state info and the previous column now shows System.Collection.Dataobject still with no header.

Any assitance would be welcome.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 16 Apr 2008, 06:45 AM
Hi John,

RadGrid does not support mixed column load i.e. part of the columns defined in .aspx and another part added programmatically, as mentioned here. You can toggle the Visible property of the column, I have attached a small page showing this. Alternatively, you can check this help topic dedicated to changing the grid structure on postback.

Regards,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
John
Top achievements
Rank 1
answered on 16 Apr 2008, 12:56 PM
Thanks, changing the visibility will do what I want.

 

 Thanks for the help.

Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Ves
Telerik team
John
Top achievements
Rank 1
Share this question
or