Template based solution in asp.net

  • Thread starter Abhishek Srivastava
  • Start date
A

Abhishek Srivastava

Hello All,

In almost all websites which I have developed, we need to follow a
layout template (header, footer, menu on left hand side etc)

In ASP.NET solutions, we can do this in two ways

1) use user controls.

But frankly, making a "control" which renders a table of width 100% with
a gif somehow to me it seems wrong. I would create a control to
encapsulate a particular piece of functionality or component. Not really
to control the page layout.

Secondly if I am changing the layout tomorrow (maybe I found a better
javascript tree library) then I have to rebuild recompile the user control.

2) Use a common base class for Code behind classes.

This is also good. but then the layout gets tied up with C# code. and
therefore, layout change would mean getting a C# programmer first.

Is there some better way of implementing templates or site look and
feel. Why not specify the layout of a page in an XML format. and then
the asp.engine doing its rendering only into a specific portion as
specified in the XML. So that If I find a better tree control I just
change the xml file so that the new javascript tree menu gets included.

regards,
Abhishek.
 
J

James Crowley

You may find it worthwhile to check out how the templates are
implemented in the ASP.NET forums (http://www.asp.net/).

Regarding the user controls - if you have a header and a footer user
control, you wouldn't have to necessarily render a table of width 100% -
just literally render whatever HTML you'd want appearing on each page.
And if you don't use CodeBehind (which you probably won't need in the
UserControl anyway - because its just acting as a template), then you
won't need to recompile - you'll just have to upload the modified
UserControl.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top