GridTemplateColumn and LoadTemplate()

2 posts, 0 answers
  1. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 18 Apr 2010 Link to this post


    I can use a usercontrol as a ItemTemplate for a GridTemplateColumn:
            Dim gct As New GridTemplateColumn 
            With gct 
                .HeaderText = "Schema" 
                .DataField = "Name" 
                .ItemTemplate = LoadTemplate("~/DynamicData/FieldTemplates/Text_List.ascx"
            End With 

    In my usercontrol in the DataBinding event (or elsewhere) i can find the DataBindingContainer and NamingContainer and find all the data i need, but:

    How do i know, in the usercontrol, that I've bound it to the datafield "name"? When using the template for more columns I have to know that...

    Thanks in advance.

  2. Veli
    Veli avatar
    2002 posts

    Posted 21 Apr 2010 Link to this post

    Hi Proovit,

    Your template user control should be concerned with this. Particularly, you need to be able to somehow pass the data field of the template column to the user control. One approach would be to first instantiate your user control from the .ascx file, then set some property in the user control indicating the data field you are binding to.

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top