Solved

How do I set up a AdRotator Control with a SqlDataSource?

Posted on 2009-05-15
2
261 Views
Last Modified: 2013-12-17
How do I set up a AdRotator Control with a SqlDataSource?

this is what i have...can you tell me what I'm dong wrong?

see attached..
.aspx
 
<asp:Timer ID="uxTimer" Interval="1000" runat="server" />
            <asp:UpdatePanel ID="uxAdRotatorUpdatePanel" runat="server">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="uxTimer" EventName="Tick" />
                </Triggers>
                <ContentTemplate>        
                    <asp:AdRotator ID="uxAnnouncementsAdRotator" runat="server" 
                                   DataSourceID="uxFrontPageSqlDataSource" />
                </ContentTemplate>
            </asp:UpdatePanel> 
 
<asp:SqlDataSource ID="uxFrontPageSqlDataSource" runat="server"
                   ConnectionString="<%$ ConnectionStrings:infonet %>"
                   SelectCommand="sp_GetFrontPageAnnouncements"
                   SelectCommandType="StoredProcedure" />
 
.cs
 
    protected void Tick(object sender, EventArgs e)
    {
        uxAdRotatorUpdatePanel.Update();
    }
 
stored proc
 
	SET NOCOUNT ON;
	SELECT AlternateTextField, NavigateUrlField, ImageUrlField
	FROM FrontPageAnnouncements 
	WHERE StartDate < getdate() AND EndDate > getdate() 
	ORDER BY OrderID;

Open in new window

0
Comment
Question by:mmedi005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
ajolly earned 500 total points
ID: 24397765
Microsoft provides a good documentation here:
http://msdn.microsoft.com/en-us/library/cc295605.aspx

Also, notice that you will get a lot of examples for using ad rotator with .xml files.
and you can convert a datatable at any point of time in a xml file.
0
 

Author Comment

by:mmedi005
ID: 24398631
only reason I use a sqldatasource is because it lets the user put a life cycle to the ad's.  The SQL statement conditions only SELECT the ones that haven't ended.  

Can I input this in an xml?
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question