Loading ...

Rotate items on a bullet-ed list (databound)

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  data access   » Rotate items on a bullet-ed list (databound)

Rotate items on a bullet-ed list (databound)

Posts under the topic: Rotate items on a bullet-ed list (databound)

Posted: 7/2/2011

Lurker 360  points  Lurker
  • Joined on: 6/5/2011
  • Posts: 51

I have a bullet-ed list that is databound I would like to rotate the items on the list. Can I do this through my SELECT statement or do I have to use the ad rotator?

<asp:BulletedList ID="FiBltLst" Font-Size="Large" ForeColor="#230FD2" 
     Font-Bold="true" runat="server"  DataSourceID="FreeItemDs"   
     DataTextField="ItemName" 
     DataValueField="ItemName">
</asp:BulletedList>

  <br />
 <asp:SqlDataSource ID="FreeItemDs" runat="server" 
      ConnectionString="<%$ ConnectionStrings:CouponBotConnectionString1 %>" 
       SelectCommand="SELECT DISTINCT TOP 10 [ItemName] FROM [Items]  WHERE
       FinalValuePrice='0.00'">                      
 </asp:SqlDataSource>

Thanks in advance.


Posted: 7/2/2011

Starter 727  points  Starter
  • Joined on: 6/6/2011
  • Posts: 74

Hi Mike,

If you want to achieve something like adrotator with bulleted list you will need a timer control for fetshing new data for this bulleted list, and this list should be an update panel, also you will have to had code-behind logic for updating this buleted list on every timers tick.

Here is a reference to a nice blog which i've used recently for a project of mine:

http://aspdotnetcodebook.blogspot.com/2008/11/adrotator-control-and-database.html

On page load you can fetch the exact sql statement you are using, and for updating you can set up the update on every timers tick toward your requirements.

Best Regards,

Gjorgji


Posted: 7/2/2011

Lurker 360  points  Lurker
  • Joined on: 6/5/2011
  • Posts: 51

Thanks  I just read that. That  helped. Some times I think if i just took a few and really thought out of the box I could probably figure it out.  Its amazing how this process has improved my problem solving skills.  Thanks again for another precise answer Gjorgji!


Posted: 7/2/2011

Lurker 360  points  Lurker
  • Joined on: 6/5/2011
  • Posts: 51

One question.

 

<asp:UpdatePanel runat="server" ID="SlideShow" UpdateMode="Conditional">

How does the updateMode="Conditional" effec the UpdatePanel?


Posted: 7/2/2011

Starter 727  points  Starter
  • Joined on: 6/6/2011
  • Posts: 74
  Answered

Hi Mike,

When UpdateMode is set to "Conditional" then the UpdatePanel will be updated only on post back originated by controls inside the panel or from the specified triggers.

Best Regards,

Gjorgji


Posted: 7/3/2011

Lurker 360  points  Lurker
  • Joined on: 6/5/2011
  • Posts: 51

Gjorgji,

I just used this in my application with a few "tweeks" works awesome! 2 things if you follow the steps from that blog, one is you can not have any fields that allow nulls in your Db. This is important if you are using an existing Db.  You get an exception that you cannot cast a System.db from null to string.  I also took out the 

<asp:Image runat="Server" ID="SlideShowImage1" ImageUrl="" Width="100%" Height="150px" />


It seems the adrotator control has the image tag within it. With the above tag in, it displays a missing image above your rotating images.

 

Thanks a lot!


Posted: 7/3/2011

Starter 727  points  Starter
  • Joined on: 6/6/2011
  • Posts: 74

Hi Mike,

Adrotator control has image tag 'ImageUrl' which is OPTIONAL, if you dont want to use image you should not set this property, the adrotator control will work.

Best Regards,

Gjorgji


Page 1 of 1 (7 items)