Posted: 7/2/2011
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>
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
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!
One question.
<asp:UpdatePanel runat="server" ID="SlideShow" UpdateMode="Conditional">
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.
Posted: 7/3/2011
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!
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.