468,301 Members | 1,436 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

Programmatically Create "Content" Areas for a Master Page

We have a data-centric application where all of the "layout" for each data
centric page is to be codified (ie. it is expressed in C# code rather than
being expressed declaratively). This codification subsequently produces the
required web-controls for a page based on whether the page is eg. in view or
update mode, examination of the user's security permissions for certain
fields, etc.

In VS2003 our "Page Master" (to use the VS2005 term) was a file that was
#included by each .aspx page and contained a number of "PlaceHolder"
controls where the "content" of the page was attached to. Hence we received
a similar outcome to Master Pages as they exist in VS2005.

I am trying to find a satisfactory way of bringing this concept across to
VS2005 and to use its Master Pages feature rather than our previous

My initial approach was to [try] programmatically generate "Content"
controls and add them to the Page's Control container, and advise each
Content object its ContentPlaceHolderlID to associate to the Master Page.
When I try do this I get an error stating that I cannot programmatically
assign a ContentPlaceHolderID to a Content object.

So this leaves me wondering how the asp parser creates a Content control
and/or where they "end up".

My workaround would to be to use the Master Page, but then I still need a
#include in order to include the content place holders that I will use on
each page. And since I'm still using #include, I don't see any advantage to
this versus my original method.

If anyone can advise some alternative techniques I'd appreciate it.
Sep 18 '06 #1
0 1336

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Steven K | last post: by
4 posts views Thread by Nathan Sokalski | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.