|
Article relates to |
RadRotator v2.x |
|
Created by |
Telerik |
|
Last modified |
December 8, 2006 |
|
Last modified by |
Peter, Telerik |
HOW TO
bind tickers programmatically?
SOLUTION
Radrotator consists of two components - rotator and ticker. It is possible to use only the ticker component. Please take into account that when you databind a rotator, the ticker can "consume" the data that is bound to the parent rotator control. When used alone, the ticker cannot be databound. However, this is not a major obstacle as tickerlines can be declaratively defined in the .aspx page, like:
| <radR:RadTicker AutoStart="true" runat="server" ID="Radticker1" Loop="true"> |
| <RadTickerLine>Nov 30, 2006 - Telerik Partners with Microsoft to Deliver Rich 2007 Office UIs </RadTickerLine> |
| <RadTickerLine>Nov 10, 2006 - Visit Telerik’s Booth at TechEd: Developers 2006 </RadTickerLine> |
| <RadTickerLine>Oct 10, 2006 - RadControls Q3 2006 – Next Generation UIs for Web and Desktop Applications</RadTickerLine> |
| </radR:RadTicker> |
A problem might appear when you need to create a ticker in code behind and dynamically add it to the page. To solve the issue we added the UserTickerLines property to the ticker class. It is used in the following way:
C#
| protected void Page_Load(object sender, EventArgs e) |
| { |
| string[] SomeTickerLines = { "line one", "line two ", "line three " }; |
| Telerik.WebControls.RadTicker aTickerLine = new Telerik.WebControls.RadTicker(); |
| aTickerLine.UserTickerLines = SomeTickerLines; |
| aTickerLine.AutoStart = true; |
| aTickerLine.Loop = true; |
| this.Controls.Add(aTickerLine); |
| } |
VB
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| Dim SomeTickerLines As String() = {"line one", "line two ", "line three "} |
| Dim aTickerLine As New Telerik.WebControls.RadTicker() |
| aTickerLine.UserTickerLines = SomeTickerLines |
| aTickerLine.AutoStart = True |
| aTickerLine.Loop = True |
| Me.Controls.Add(aTickerLine) |
| End Sub |
It can also be used in the .aspx file if you find it more convenient:
| <radr:radticker id="RadTicker2" runat="server" |
| UserTickerLines="Line one, Line two, Line three" |
| autostart="True"> |
| </radr:radticker> |
This property can be also set at design time.
There are no comments yet.
Please Sign In to rate this article.