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

ItemTemplate sample error

1 Answer 24 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 16 Sep 2014, 12:33 PM
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

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 19 Sep 2014, 07:57 AM
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.

 
Tags
PanelBar
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Boyan Dimitrov
Telerik team
Share this question
or