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

GridTemplateColumn and LoadTemplate()

1 Answer 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 2
Erik asked on 18 Apr 2010, 12:13 PM
Hi,

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 
        GridView1.MasterTableView.Columns.Add(gct) 

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.

Erik

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 21 Apr 2010, 02:33 PM
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.

Greetings,
Veli
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.
Tags
Grid
Asked by
Erik
Top achievements
Rank 2
Answers by
Veli
Telerik team
Share this question
or