Templating options

Templating options

Post by Jaso » Fri, 14 Mar 2003 04:42:16



I'd like to ask what people's experiences are with templating using ASP.NET

I've seen the common method of defining a template class which overrides
Render and inheriting from this.

This method wasn't suitable. First I couldn't get it to work, but also I
wanted to some controls in the early part followed by more template code.

To get round this, my template class has three public methods defined, which
do a load of Response.Write statements. The HTML code then looks something
like this

<& Page ... etc>

<% RenderHeader() %>
Code
<% RenderMid() %>
More code
<% RenderFooter() %>

... and for the most part this works very well. However, there are two main
disadvantages.

1.    Attempting to add a control in the code behind class doesn't work
becuase of the <% %> tags (at least thats what it tells me)
2.    Visual Studio is constantly compaining that when I start a <TABLE>
tag, it doesn't have a parent object (because this is defined in the
RenderHeader method.

As an alternative, does ASP.NET have the facility for placeholders. So I can
define the bare bones of a page (<HTML> <HEAD> tags) which will keep VS
happy and insert various placeholders throughout the page, which when the
page is accessed will render onto the page, maintaining the whole point of
templating which is to make everything consistent and easy to change.

This isn't a massive issue, but I would like to know what others have done
in the past before my site grows too much.

Jason

 
 
 

Templating options

Post by Victor Garcia Aprea [MVP » Fri, 14 Mar 2003 05:48:05


Hi Jason,

I highly recommend the Master Pages sample written by David Ebbo at
Microsoft. Its a simple yet powerful sample that you could extend to make it
meet your specific requirements. I dont have a download link handy but look
at the Control Gallery in www.asp.net, its there.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
--
Learning ASP.NET, C# and VS.NET? Look at this book:
Beginning C# Web Applications with Visual Studio .NET
http://www.amazon.com/exec/obidos/ASIN/1861007329/laplatayacom


Quote:> I'd like to ask what people's experiences are with templating using
ASP.NET

> I've seen the common method of defining a template class which overrides
> Render and inheriting from this.

> This method wasn't suitable. First I couldn't get it to work, but also I
> wanted to some controls in the early part followed by more template code.

> To get round this, my template class has three public methods defined,
which
> do a load of Response.Write statements. The HTML code then looks something
> like this

> <& Page ... etc>

> <% RenderHeader() %>
> Code
> <% RenderMid() %>
> More code
> <% RenderFooter() %>

> ... and for the most part this works very well. However, there are two
main
> disadvantages.

> 1.    Attempting to add a control in the code behind class doesn't work
> becuase of the <% %> tags (at least thats what it tells me)
> 2.    Visual Studio is constantly compaining that when I start a <TABLE>
> tag, it doesn't have a parent object (because this is defined in the
> RenderHeader method.

> As an alternative, does ASP.NET have the facility for placeholders. So I
can
> define the bare bones of a page (<HTML> <HEAD> tags) which will keep VS
> happy and insert various placeholders throughout the page, which when the
> page is accessed will render onto the page, maintaining the whole point of
> templating which is to make everything consistent and easy to change.

> This isn't a massive issue, but I would like to know what others have done
> in the past before my site grows too much.

> Jason


 
 
 

1. Creating from Templates not in Templates folder in Excel 2000

My C# programme uses a template to create a new spreadsheet via Excel
interop.  This template seems to need to be in a folder inside the
current user's documents and settings area.  I would like, however, to
keep the template with all the other files for the project (dll, exe,
xml, gif, etc).  Is this possible and still be able to create from a
template?  This is with Excel 2000.  So far, unless the file is in the
"secret place," it will not work.

thanks

2. Ways to import data

3. C#'s <summary> & /doc options - is there a corollary option for VB.NET

4. v.2.11 whre can i get it

5. Error when using Nokia 9210 'www' Option. But, works in 'wap' option

6. Notes crashes on Win XP

7. How can I get the value of GridSize and DrawGrid from .NET Framework Designer options?

8. C# .Net developer with ASP and SQL

9. Copying Dataset from WebService to database (RowState issue) - Options??

10. options in ado and ado.net

11. Struggling with Mass SQL insert/update options

12. Design Table Option Gone

13. framework runtime standalone database options?