By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,370 Members | 1,581 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,370 IT Pros & Developers. It's quick & easy.

Template based solution in asp.net

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

In article <#1**************@TK2MSFTNGP09.phx.gbl>, abhishek-
sr********@nospam.net says...
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.


--
~ James Crowley
http://www.developerfusion.com/
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.