How to bind RadRotator to List<t>

10 posts, 1 answers
  1. Flea#
    Flea# avatar
    10 posts
    Member since:
    Apr 2009

    Posted 03 May 2009 Link to this post

    Hello,

    I have a List<string> collection and I was wondering if it was possible to bind the rad rotator to this list collectiong? What I have currently does not work; I can't get any data to show up.

    Here is what I have for the aspx page:

                <telerik:RadRotator ID="catholicFactRotator" runat="server" RotatorType="AutomaticAdvance"  
                FrameDuration="3000" ScrollDirection="Up" > 
                </telerik:RadRotator>  

    Here is what I have for my code behind:

        protected void Page_Load(object sender, EventArgs e) 
        { 
            Data data = new Data(); 
     
            this.radrotator1.DataSource = data.GetListofStrings(); 
            this.radrotator1.DataBind(); 
        } 

    I don't receive any errors on the page, but nothing shows up. I appreciate any help!

    Thanks,
    Flea#
  2. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 05 May 2009 Link to this post

    Hi Flea#,

    You can bind the RadRotator control to a List<string> object, but you need to define an ItemTemplate in order to achieve the desired result. For example :
    • The codebehind :
      protected void Page_Load(object sender, EventArgs e) 
          List<string> list = new List<string>() { "Item 1""Item 2""Item 3" }; 
          RadRotator1.DataSource = list; 
          RadRotator1.DataBind(); 
    • Declare a RadRotator control with an ItemTemplate  on the ASPX page :
      <telerik:RadRotator ID="RadRotator1" runat="server" Width="100" ItemWidth="100" Height="110" 
          ItemHeight="110"
          <ItemTemplate> 
              <div> 
                  <%# Container.DataItem %> 
              </div> 
          </ItemTemplate> 
      </telerik:RadRotator> 

    This setup will work in your scenario. I hope this helps.


    Regards,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Flea#
    Flea# avatar
    10 posts
    Member since:
    Apr 2009

    Posted 05 May 2009 Link to this post

    Thanks Fiko, that fixed it right up! I appreciate your help!

    -Flea#
  5. Cristian
    Cristian  avatar
    46 posts
    Member since:
    May 2011

    Posted 27 Jun 2012 Link to this post

    Hi, I'm trying to bind the in code behind a radrotator with image buttons.
    Fiko's example seems to be the solution but what should I put in ItemTemplate in order to make visible the buttons?

    Hope your help.
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Sep 2012 Link to this post

    Hi Cristian,

    I suppose you want to bind the ImageButton into the ItemTemplate of RadRotator. Try the following code.

    ASPX:
    <telerik:RadRotator ID="RadRotator1" runat="server" Width="100" ItemWidth="100" Height="110" RotatorType="Buttons" ItemHeight="110">
      <ItemTemplate>
         <div>
            <asp:ImageButton ID="btn" runat="server" ImageUrl="<%# Container.DataItem %>" />
         </div>
      </ItemTemplate>
    </telerik:RadRotator>

    C#:
    protected void Page_Load(object sender, EventArgs e)
        {
            List<string> list = new List<string>() { "~/Images/image1.jpg", "~/Images/image2.jpg", "~/Images/image3.jpg" };
            RadRotator1.DataSource = list;
            RadRotator1.DataBind();
        }

    Please elaborate your scenario if it doesn't helps.

    Regards,
    Princy.
  7. Manu
    Manu avatar
    24 posts
    Member since:
    Aug 2015

    Posted 10 Feb in reply to Princy Link to this post

    hi Princy,

    i created charts as usercontrols

    i have to add user control objects to radrotator in code behind.

    how i can do that?

    help me out from this..

    thanks in advance!

     

  8. Manu
    Manu avatar
    24 posts
    Member since:
    Aug 2015

    Posted 10 Feb in reply to Manu Link to this post

    No thanks :)
    i worked on it ! and i did it :)
  9. RJ
    RJ avatar
    386 posts
    Member since:
    Oct 2006

    Posted 15 Sep Link to this post

    Hi Manu,

    Can you share your codes, my requirements is same like yours.

    Thanks in advance!

  10. RJ
    RJ avatar
    386 posts
    Member since:
    Oct 2006

    Posted 24 Nov Link to this post

    No Thanks!

    bootstrap carousel does the job.

  11. Manu
    Manu avatar
    24 posts
    Member since:
    Aug 2015

    Posted 24 Nov in reply to RJ Link to this post

    oo nice.. and sorry, i have not seen your previous post.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017