ItemTemplate sample error

2 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 16 Sep 2014 Link to this post

    Hi,

    On this page:

    http://www.telerik.com/help/aspnet-ajax/panelbar-add-templates-runtime.html

    when deploying the first VB.NET sample I get error:

    Compiler Error Message: BC30205: End of statement expected.

    On this line

    Line 22: Class TextBoxTemplate Implements ITemplate

    I am trying to implement this in a Masterpage environment.
    Any ideas?

    Marc
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 19 Sep 2014 Link to this post

    Hello Marc,

    Indeed there is a problem if you just copy and paste the first code snippet in your code behind file. Please try to use the following syntax and structure:
    //code behind
    Class TextBoxTemplate
        Implements ITemplate
     
     
     
        Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
            Dim label1 As New Label()
            label1.ID = "ItemLabel"
            label1.Text = "Text"
            label1.Font.Size = 15
            label1.Font.Bold = True
            AddHandler label1.DataBinding, AddressOf label1_DataBinding
            container.Controls.Add(label1)
        End Sub
     
        Private Sub label1_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
            Dim target As Label = DirectCast(sender, Label)
            Dim item As RadPanelItem = DirectCast(target.BindingContainer, RadPanelItem)
            Dim itemText As String = DirectCast(DataBinder.Eval(item, "Text"), String)
            target.Text = itemText
        End Sub



    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top