Solved

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

Posted on 2009-05-15
2
255 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
2 Comments
 
LVL 7

Accepted Solution

by:
ajolly earned 500 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now