Hi All,
I know that RadTicker can get data from XMLDataSource. But now I need to get data from database. Is RadTicker able to do this? In my case, I put RadTicker in RadRotator. I got items for RadRotator dynamically from database, programming in the server side. So now how can RadTicker get items from database ?
Thank you !
I know that RadTicker can get data from XMLDataSource. But now I need to get data from database. Is RadTicker able to do this? In my case, I put RadTicker in RadRotator. I got items for RadRotator dynamically from database, programming in the server side. So now how can RadTicker get items from database ?
Thank you !
4 Answers, 1 is accepted
0
Hello Y L,
In general you can use this approach in order to load the data in both controls:
Please note that you can load the data from server-side code by setting a collection to the RadRotator's DataSource property and calling its DataBind() method. The shown RadRotator and RadTicker's markup will work in this case as well.
Kind regards,
Fiko
the Telerik team
In general you can use this approach in order to load the data in both controls:
<
telerik:RadRotator
ID
=
"RadRotator1"
DataSourceID
=
"SqlDataSource1"
runat
=
"server"
Width
=
"200"
ItemWidth
=
"200"
Height
=
"100"
ItemHeight
=
"100"
>
<
ItemTemplate
>
<
div
>
<
div
>
<
span
>Product Name: '<%# Eval("ProductName")%>'</
span
> <
span
>Product ID: '<%# Eval("ProductName")%>'</
span
>
</
div
>
<
telerik:RadTicker
ID
=
"RadTicker1"
runat
=
"server"
>
<
Items
>
<
telerik:RadTickerItem
Text='<%# Eval("ProductName")%>' />
</
Items
>
</
telerik:RadTicker
>
</
div
>
</
ItemTemplate
>
</
telerik:RadRotator
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductID], [ProductName] FROM [Alphabetical list of products]">
</
asp:SqlDataSource
>
Please note that you can load the data from server-side code by setting a collection to the RadRotator's DataSource property and calling its DataBind() method. The shown RadRotator and RadTicker's markup will work in this case as well.
Kind regards,
Fiko
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Y L
Top achievements
Rank 1
answered on 06 Jul 2010, 03:52 PM
Hi Fiko,
Thank you very much for your reply !
In my case, RadRotator got data from server side and I added RadTicker inside RadRotator, then I don't know how to program server side for RadTicker ..
Here is my code in aspx file:
Here is my code in aspx.vb file, how I loaded data from server side for RadRotator:
The RadRotator is working now, but I don't know how to load data dynamically for RadTicker.
Can you help me with this?
Thank you very much !
Thank you very much for your reply !
In my case, RadRotator got data from server side and I added RadTicker inside RadRotator, then I don't know how to program server side for RadTicker ..
Here is my code in aspx file:
<telerik:RadRotator ID="rUpcomingEvents" runat="server" BorderWidth ="1px" BorderColor ="#3576b1" FrameDuration ="1000" ScrollDuration ="1500" |
Height ="280px" Width ="180px" ScrollDirection ="Up" > |
<ItemTemplate > |
<telerik:RadTicker ID="tickerEvents" runat="server" > |
<Items > |
<telerik:RadTickerItem ID="Subject" >Test</telerik:RadTickerItem> |
</Items> |
</telerik:RadTicker> |
</ItemTemplate> |
</telerik:RadRotator> |
Here is my code in aspx.vb file, how I loaded data from server side for RadRotator:
Dim al As New ArrayList() |
rUpcomingEvents.ItemTemplate = New RadRotatorTemplate() |
rUpcomingEvents.DataSource = al |
rUpcomingEvents.DataBind() |
Public Class RadRotatorTemplate |
Implements ITemplate |
Public Sub New() |
End Sub |
#Region "ITemplate Members" |
Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn |
Dim wrapper As New HtmlGenericControl("div") |
AddHandler wrapper.DataBinding, AddressOf wrapper_DataBinding |
container.Controls.Add(wrapper) |
End Sub |
#End Region |
Sub wrapper_DataBinding(ByVal sender As Object, ByVal e As EventArgs) |
Dim wrapper As HtmlGenericControl = TryCast(sender, HtmlGenericControl) |
Dim item As RadRotatorItem = TryCast(wrapper.NamingContainer, RadRotatorItem) |
wrapper.InnerHtml = String.Format(" {0} ", CType(item.DataItem, String)) |
End Sub |
End Class |
The RadRotator is working now, but I don't know how to load data dynamically for RadTicker.
Can you help me with this?
Thank you very much !
0
Y L
Top achievements
Rank 1
answered on 06 Jul 2010, 04:43 PM
In my case, I put RadTicker inside RadRotator and I tried to load data for RadTicker like what you did:
It's not working. There's no ticker after I run it. I'm not sure if it's because my rotator got data dynamically from server side..
<
telerik:RadTicker
ID
=
"RadTicker1"
runat
=
"server"
>
<
Items
>
<
telerik:RadTickerItem
Text='<%#
Eval("ProductName")%>' />
</
Items
>
</
telerik:RadTicker
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$
ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductID], [ProductName] FROM [Alphabetical
list of products]">
</
asp:SqlDataSource
>
It's not working. There's no ticker after I run it. I'm not sure if it's because my rotator got data dynamically from server side..
0
Hello Y L,
For your convenience I have attached a demo project. Could you please rework it in order to show the problem, open a new support ticket and send it back? I will check it on my side and do my best to provide a working solution as soon as possible.
Sincerely yours,
Fiko
the Telerik team
For your convenience I have attached a demo project. Could you please rework it in order to show the problem, open a new support ticket and send it back? I will check it on my side and do my best to provide a working solution as soon as possible.
Sincerely yours,
Fiko
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items