Rotator Image Folder

2 posts, 0 answers
  1. Mazdak
    Mazdak avatar
    2 posts
    Member since:
    Jul 2010

    Posted 15 Jun 2011 Link to this post

    Hi.

    I have some folders in my solution such as UserAccount, Admin, etc.
    I bind rotator to XmlDataSource, but when I'm not in site root (ex: MySiteName/Admin/Default.aspx) rotator does not work.
    Here is the code:

     

     

     

     

    <telerik:RadRotator ID="RadRotator1" runat="server" Height="150px"
      ItemHeight="150px" ItemWidth="600px" ScrollDirection="Up" ScrollDuration="4000" 
      Width="600px" DataSourceID="XmlDataSource1">
      <ItemTemplate>
        <div>
          <a href="<%# XPath("href") %>">
            <img src="IMG/<%# XPath("filename") %>" alt="IMG/<%# XPath("filename") %>" style="border: 0px;"/>
          </a>
        </div>
      </ItemTemplate>
    </telerik:RadRotator>
    </div>
    <asp:XmlDataSource ID="XmlDataSource1" runat="server" 
      DataFile="~/Banners.xml" ></asp:XmlDataSource>

     

     

     

  2. Mazdak
    Mazdak avatar
    2 posts
    Member since:
    Jul 2010

    Posted 16 Jun 2011 Link to this post

    Hi there.
    I solve problem:

    In C#
    public string PATH = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        string _path = this.BaseUrl + "IMG/";
        this.PATH = _path;
    }
     
    public string BaseUrl
    {
        get
        {
            string url = this.Request.ApplicationPath;
            if (url.EndsWith("/"))
                return url;
            else
                return url + "/";
        }
    }

    ASPX Page
    <telerik:RadRotator ID="RadRotator1" runat="server" Height="150px"
      ItemHeight="150px" ItemWidth="600px" ScrollDirection="Up" ScrollDuration="4000"
      Width="600px" DataSourceID="XmlDataSource1">
      <ItemTemplate>
        <div>
          <a href="<%# XPath("href") %>">
            <img src="<%# PATH + XPath("filename") %>" alt="<%# PATH + XPath("filename") %>" style="border: 0px;"/>
     
          </a>
        </div>
      </ItemTemplate>
    </telerik:RadRotator>

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top