Scott on Writing

Musings on technical writing...

Request for Comments: A ContentRotator Web Control

I am in the midst of building a custom ASP.NET server control I call skmContentRotator, which is similar in semantics and syntax to the AdRotator control.  Like the AdRotator, the ContentRotator has an XML-formatted file that spells out the content to rotate through.  The main difference between the two controls is that while the AdRotator randomly rotates through ads, the ContentRotator will rotate through arbitrary content.

In its simplest form, the ContentRotator would just allow vanilla HTML markup to be emitted.  Of course, ideally the control would allow for the content to be dynamically determined; for example, if you wanted to display some random welcome messages, you might want to include the current date/time, or the name of the currently logged on user.  Or if you ran an eCommerce site you might want to randomly display “hot deals,” which might entail displaying information about a random product from a subset of products (where the product information was stored in a database).

What do you think would be the best way to allow for this dynamic capability?  Right now, I'm leaning toward having any dynamic capability required to be wrapped up in a User Control, and then the page developer would reference the path to the User Control in the XML file that spells out the content to rotate through.  That is, say one of the random pieces of content you wanted to rotate through was a page that had a DataGrid with some products listed.  To accomplish this, you'd first create a User Control - call it RecentProducts.ascx - that had the required Web controls and source code.  Then, in the content file you'd add an item like:

<content contentPath=”~/RecentProudcts.ascx” />

On the other hand, if you just wanted to squirt in some static text into the rotation, you'd add a content item like:

<content>
  
static text
</content>

Any comments on this approach?  Are there any features for a content rotator you can think of that are must-have?  Any comments/suggestions appreciated.

posted on Tuesday, February 22, 2005 4:38 PM

Feedback

# re: Request for Comments: A ContentRotator Web Control 2/23/2005 7:43 AM gvishal

More like MSDN front page ..They have abilty to rotate the top 2 contents ..

# re: Request for Comments: A ContentRotator Web Control 2/23/2005 10:16 AM Helen

Could you make it so that it'll hook up to a list with a certain interface so that you could fill your list with content from a database or an XML file or a text file and then specify it as a datasource for the ContentRotator? It'd be less easy to use, but very, very flexible.

# re: Request for Comments: A ContentRotator Web Control 2/23/2005 2:13 PM Scott Mitchell

Helen, what I have currently done is allowed the ContentRotator's contents to be specified via an external XML-formatted file (like AdRotator). In addition, ContentRotator's content elements can be set declaratively and/or programmatically added, much like the DropDownList's Items collection can be set declaratively or programmatically.

# re: Request for Comments: A ContentRotator Web Control 3/6/2005 5:47 PM Phil Guerra

Scott,

Just got to this post on your blog. I've toyed with this idea from a slightly different perspective. I'm looking at creating RSSnewfeed Rotator, taking content from a newsfeed or list of newsfeeds and randomly going thru them displaying them like the MSN news site does. Only I think they are using some kind of script to do it. I think using RSSv2 with enclosures for media is the way I've been approaching it.

Does this sound like a similar thing to you?

# Comment Spam Script Gone Awry 3/6/2005 9:59 PM Scott on Writing

# re: Request for Comments: A ContentRotator Web Control 3/14/2005 11:27 AM Duncan Mackenzie

Allowing dynamic content as well as static is an interesting idea, mine only does static materials... http://msdn.microsoft.com/vbasic/default.aspx?pull=/library/en-us/dncodefun/html/code4fun09072004.asp

# re: Request for Comments: A ContentRotator Web Control 12/23/2007 11:56 PM ruslan

why you have implemented IStateManger in contetitem, could not we just use the ready use Viewstate that comes from Control class... seems its does do anything special apart from calling base class methods... am I missing something?
thanks

Title:  
Name:  
Url:
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments   

Add To Your Reader

My Links

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<May 2008>
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Comment Stats

DayTotal% of Total
Sunday 1866.8%
Monday 37913.9%
Tuesday 45316.7%
Wednesday 50418.5%
Thursday 53519.7%
Friday 49418.2%
Saturday 1666.1%
Total 2717100.0%

Hour1Total% of Total
12:00 AM 652.4%
1:00 AM 682.5%
2:00 AM 622.3%
3:00 AM 742.7%
4:00 AM 572.1%
5:00 AM 1033.8%
6:00 AM 1084.0%
7:00 AM 1585.8%
8:00 AM 1716.3%
9:00 AM 1475.4%
10:00 AM 1716.3%
11:00 AM 1816.7%
12:00 PM 1886.9%
1:00 PM 1696.2%
2:00 PM 1605.9%
3:00 PM 1324.9%
4:00 PM 1073.9%
5:00 PM 923.4%
6:00 PM 913.3%
7:00 PM 963.5%
8:00 PM 833.1%
9:00 PM 782.9%
10:00 PM 792.9%
11:00 PM 772.8%
Total 2717100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 5.54144
Monday 5.22339
Tuesday 4.28419
Wednesday 7.67637
Thursday 6.90607
Friday 5.48411
Saturday 5.33160
Total 5.842717

Hour1 Entry MadeAvg.Total
12:00 AM 5.0035
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 7.0035
8:00 AM 5.35107
9:00 AM 6.32278
10:00 AM 6.47246
11:00 AM 4.41181
12:00 PM 6.88330
1:00 PM 3.00111
2:00 PM 5.41222
3:00 PM 8.64285
4:00 PM 4.0589
5:00 PM 5.92154
6:00 PM 4.52113
7:00 PM 9.67174
8:00 PM 9.80147
9:00 PM 5.05111
10:00 PM 5.4265
11:00 PM 4.5732
Total 5.842717

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles