Link to home
Start Free TrialLog in
Avatar of mmedi005
mmedi005

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of ajolly
ajolly
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mmedi005
mmedi005

ASKER

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?