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

Rotator and LOD problem

1 Answer 23 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
maha
Top achievements
Rank 1
maha asked on 23 Aug 2010, 10:46 AM
I have the following code :
<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
   </telerik:RadScriptManager>
  
   <div>
     <telerik:RadAjaxPanel ID="AjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1">
       <div style="float: left; margin: 38px 0s 0 120px; border: solid 1px grey; width: 300px;
           height: 152px;">
           <telerik:RadRotator ID="RadRotator1" runat="server" Width="220px" Height="135px"
               ItemHeight="135" ItemWidth="110" CssClass="positionCenter" ScrollDuration="500"
              >
              <WebServiceSettings Path="RotatorWebService.asmx" Method="GetRotatorData" />
           </telerik:RadRotator>
       </div>
        
   </telerik:RadAjaxPanel>
   </div>
   </form>

Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.Script.Services
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Web.UI
Imports Telerik.Web.UI
Imports System.Web.UI.WebControls
Imports System.IO
Imports System.Reflection
Imports System.Threading
Imports System.Xml
  
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class RotatorWebService
    Inherits System.Web.Services.WebService
  
    'Private data As DataTable
    Private itemCount As Integer = 5
  
    <WebMethod()> _
Public Function GetRotatorData(ByVal itemIndex As Integer) As RadRotatorItemData()
        If itemIndex >= 11 Then
            Return Nothing
        End If
        Dim result As New List(Of RadRotatorItemData)()
        Dim m_xmlr As XmlTextReader
        'Create the XML Reader
          
  
  
        For i As Integer = itemIndex To itemIndex + (itemCount - 1)
            Dim item As New RadRotatorItemData()
  
            m_xmlr = New XmlTextReader("C:\generated_files\bitems.xml")
            m_xmlr.WhitespaceHandling = WhitespaceHandling.None
            m_xmlr.Read()
  
            m_xmlr.Read()
  
            While Not m_xmlr.EOF
                m_xmlr.Read()
  
                If Not m_xmlr.IsStartElement() Then
                    Exit While
                End If
                Dim genderAttribute = m_xmlr.GetAttribute("book")
                m_xmlr.Read()
                Dim src = m_xmlr.ReadElementString("src")
                Dim link = m_xmlr.ReadElementString("link")
                Dim ii = m_xmlr.ReadElementString("i")
                If (ii = i) Then
                    Dim img As New Image()
                    Dim imgUrl As String = src
                    imgUrl = imgUrl.Replace("~/", HttpContext.Current.Request.ApplicationPath + "/").Replace("//", "/")
                    img.ImageUrl = imgUrl
  
                    img.Width = Unit.Pixel(110)
                    img.Height = Unit.Pixel(135)
                    Dim sw As New StringWriter()
                    Dim writer As New HtmlTextWriter(sw)
                    img.RenderControl(writer)
                    writer.Flush()
                    item.Html = sw.ToString()
                    result.Add(item)
                End If
            End While
            m_xmlr.Close()
  
  
             
        Next
        Return result.ToArray()
    End Function
  
End Class

and the error i get when i run the  page is attached as an image

1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 25 Aug 2010, 02:16 PM
Hello Maha,

RadRotator's LOD feature uses MS AJAX and to allow this Web Service to be called from script you need to uncomment the following line:
' <System.Web.Script.Services.ScriptService()>

Best wishes,
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
Tags
Rotator
Asked by
maha
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or