Master Pages Great! But what about Master User Controls?

  • Thread starter Electrified Research
  • Start date
E

Electrified Research

From ASP.NET 1.1 I have a very useful UserControl which acts like a
template control. I call it a CustomTemplate.

Basically it gives me a re-usable look to sections of the site without
having to tinker with HTML. This is very much like what is being done
by Master Pages but with a User Control.

I have a two part question:
1. Is there some magical new way to do this in ASP.NET 2.0 and have it
show up nice in Design Mode?
2. If not how can I create a re-usable, easy as editing a UserControl
like template which Design Mode will render nicely.

Thanks.
 
C

clintonG

They claim Master Pages are supported in the designer but that has proven a
partial truth.
For example, nested Masters do not render in the designer. Other aspects of
page design such as the use of various uses of CSS will not render in the
designer either. Its a bit disconcerting at first but I've become used to
it.

The answer to your second question is to put your water wings on and jump in
but be prepared to live the life of the pioneering spirit.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
 
C

clintonG

<snip />

Sorry, I forgot to explain, the Master Page becomes the user control.

<%= Clinton Gallagher
 
E

Electrified Research

So you can use Master Pages as Master User Controls and not just Pages?
 
G

Guest

1. Is there some magical new way to do this in ASP.NET 2.0 and have it
show up nice in Design Mode?

No magical way. The Master Page functionality sets up a "server control"
that renders the common elements. The IDE rendering the control is based
solely on the programmers allowing this. There is currently no magic way to
set up your own control to do this. Migrating to a master page would be the
easiest, if possible.

If not possible, consider creating a compiled server control, as it will
render, according to the Render() method, in the IDE. YOu can then template
the Page and start using your new page template for all new pages.
2. If not how can I create a re-usable, easy as editing a UserControl
like template which Design Mode will render nicely.

I know of no way to set up a control that allows drag and drop and renders
in the design surface. Perhaps this is something Microsoft can look at in the
future. Barring that, you would have to create your own designer for your
custom control, which is a lot of work if you ask me.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
G

Guest

No exactly. Master pages are coded like user controls and inherit from the
control hierarchy in the BCL. That is what Clinton was talking about.

There is no master user control set up, but it is a good idea for future
endeavors. :)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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

Top