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

Template with Header Row Combobox

1 Answer 23 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 03 Jul 2012, 08:24 PM
Hello,

I am not sure the best way of asking this without it getting to be a book of explanation.  I need to have the grid be able to have a template all via code to allow me to add columns on the fly.  ( I want the user to simply hit a plus button next to the grid or contained within the grid that adds the column to the end of the grid)  The column header needs to contain a dropdown as well that would get filled upon creation.  

When I commit this data to the database I will need to be able to read the value from the dropdown as that is a foreign key on the underlying table.  

Any help or examples would be appreciated.  

Thanks.

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 06 Jul 2012, 09:04 AM
Hello,

 This is not automatically supported by the RadGrid control. You can have a look at this online demo which shows how you can dynamically add columns from code behind (note that this should be done in Page_Load or Page_Init event so that their state is persisted properly). As for the combobox in the header it is better to use GridTemplateColumn and build its HeaderTemplate programatically on the server and add and bind the combobox there as shown in this help topic. in the "Creating template columns programmatically" section.

Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Aaron
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or