Templating with UserControls and WebControls.Repeater

D

David R

C# ASP.NET1.1 w/ VS2003 on IIS6

Hi

In my application, I have a "PageTemplate.ascx" that contains a
user-provided template for a page with 2 controls on it, one of these is a
content placeholder.

In my BasePage class, the content placeholder is replaced with content
gleaned from a database, but this is where it gets tricky.

Some of the content is repeatable, so I figured that I should
programattically create a WebControls.Repeater, and load the ItemTemplate
from an *.ascx file (With LoadControl() ).

But then I wondered how I do databinding or actually fill in the content,
and then I found out that Repeater.ItemTemplate doesn't accept
System.Web.UI.Control as a value, instead it's "ITemplate", and the
documentation on that is just confusing.

Any ideas or recommendations on where to look or what to do?

Thanks
 
A

agapeton

I would recommend you not use an ascx control, but a server control.
The keyword there was "programatically".

Basically you have a method (CreateChildControls) which you will use to
create the page and will do the databinding for whatever and that
binding will databind other things and those things could databind
other things and so on. You have absolute control over everything...

Here's a video to get your started... just look at what this guy did.

http://channel9.msdn.com/Showpost.aspx?postid=122122
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top