Adding GridTemplateColumn via codebehind

4 posts, 0 answers
  1. James
    James avatar
    60 posts
    Member since:
    Sep 2007

    Posted 23 Jan 2009 Link to this post

    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
  2. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 23 Jan 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. James
    James avatar
    60 posts
    Member since:
    Sep 2007

    Posted 23 Jan 2009 Link to this post

    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

     

  5. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 27 Jan 2009 Link to this post

    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.
Back to Top