ItemTemplate sample error

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

    Posted 16 Sep 2014 Link to this post


    On this page:

    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?

  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2020 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
        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

    Boyan Dimitrov

    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.

Back to Top