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

Adding GridTemplateColumn via codebehind

3 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 23 Jan 2009, 04:38 PM
Hi,

Is it possible to add a GridTemplateColumn to a grid using the init or load event of the code behind page? My problem is that I add the coumn in design, but if I change the datasource and get the grid to refresh itself in the designer, my custom GridTemplateColumn columns get removed

thx

Bobby

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 23 Jan 2009, 04:45 PM
Hello Bobby,

Please examine the following document:
Programmatic creation
You need to scroll down a bit until you reach the "Creating template columns programmatically" section.

Let us know if you need more information.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
James
Top achievements
Rank 1
answered on 23 Jan 2009, 07:49 PM
Hi Daniel,

Thanks for the reply, just trying it now. I've noticed a mistake on the VB code in the listing however. The class MyTemplate has a method called InstantiateIn, but it hasn't got the implements on the end:

Public Sub InstantiateIn(ByVal container As System.Web.UI.Control)

should be:

Public

 

Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn

 

0
Daniel
Telerik team
answered on 27 Jan 2009, 03:15 PM
Hello Bobby,

Thank you for your suggestion.

I already corrected the mentioned line. The updated article should be online soon.

I also updated your Telerik points as a sign of gratitude.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
James
Top achievements
Rank 1
Answers by
Daniel
Telerik team
James
Top achievements
Rank 1
Share this question
or