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

Client Side Template Without WebService Binding

1 Answer 99 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
TGMSoft Developer
Top achievements
Rank 1
TGMSoft Developer asked on 27 Jan 2015, 12:47 PM
I need to have a client side template on my application without using webservice binding.

When I try to use client side template with other types of databing like datatable or arraylist the client side template does not
maintain its layout.

The reason I need this is because I need client side template with load on demand.

For example: 
* The bellow code adds an item but doens't preseve the client template
Dim itemData As New RadListBoxItem()
itemData.Text ="Text"
itemData.Attributes.Add("Attr1", "Attr1")
itemData.Attributes.Add("Attr2", "Attr2")
itemData.Attributes.Add("Attr3", "Attr3")
radListBox.Items.Add(itemData)

* The code below works when its set as webservice biding
Dim result As New List(Of RadListBoxItemData)()
Dim itemData As New RadListBoxItemData()
itemData.Text = "Text"
itemData.Attributes.Add("Attr1", "Attr1")
itemData.Attributes.Add("Attr2", "Attr2")
itemData.Attributes.Add("Attr3", "Attr3")
result.Add(itemData)

Return result.ToArray()

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 30 Jan 2015, 09:03 AM
Hello,

In order to properly bind the added items at server-side, when client templates are used, you should call the bindTemplate() for each item. I have prepared a sample example, demonstrating such implementation, which you can find attached.This and more information on the matter, could be found in the Client Templates documentation article :

http://www.telerik.com/help/aspnet-ajax/listbox-client-templates.html

However, if you need to bind the controls at server-side, we recommend the usage of the  ItemTemplates, as demonstrated in the documentation article below:

http://www.telerik.com/help/aspnet-ajax/listbox-templates-overview.html

Regards,
Nencho
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
ListBox
Asked by
TGMSoft Developer
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or