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

Adding extra columns programmatically when using automatic columns

2 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 31 Jan 2008, 11:58 PM
Is it possible to add additional columns to the rad grid if the grid columns are being built automatically (by setting the property AutoGenerateColumns)?

I have a dynamic grid which in most cases it is fine to leave the automatically generated columns, however in some instances, I want to hide an automatically generated column and replace it with a drop down column for example (this column should function correctly in edit mode as well)

What is the best approach? Should I just add a drop downlist control to the cell of the particular column? Or should i create a whole new column?

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 01 Feb 2008, 11:46 AM
Hello EmpowerIT,

If you want to work with automatic updates you can use ColumnCreated event to set desired column Visible property to false and add desired column to the grid using this approach:
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Hierarchy/DefiningStructure/DefaultCS.aspx

Other possible solution is to add GridTemplateColumn with two-way data-binding. More info can be found here:

http://www.telerik.com/help/radcontrols/prometheus/grdProgrammaticCreation.html

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
EmpowerIT
Top achievements
Rank 2
answered on 05 Feb 2008, 01:11 AM
Hi Vlad,
Thanks for the reply. I ended up just catching the ItemCreated event and adding my controls to the controls collection of the required column. Seemed to be a lot easier than actually creating a whole new column

Thanks,
Tags
Grid
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
Vlad
Telerik team
EmpowerIT
Top achievements
Rank 2
Share this question
or