Rotator and LOD problem

2 posts, 0 answers
  1. maha
    maha avatar
    44 posts
    Member since:
    Jun 2010

    Posted 23 Aug 2010 Link to this post

    I have the following code :
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
         <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" />

    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:="")> _
    <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
                While Not m_xmlr.EOF
                    If Not m_xmlr.IsStartElement() Then
                        Exit While
                    End If
                    Dim genderAttribute = m_xmlr.GetAttribute("book")
                    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)
                        item.Html = sw.ToString()
                    End If
                End While
            Return result.ToArray()
        End Function
    End Class

    and the error i get when i run the  page is attached as an image
  2. Fiko
    Fiko avatar
    1406 posts

    Posted 25 Aug 2010 Link to this post

    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,
    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
Back to Top