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

    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
  2. Veli
    Admin
    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.

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top