Thursday, March 22, 2012

Structuring web pages

Hi,

New to ASP.NET. I am in search of resources that show best-practice for structuring web pages. What I mean by this, is how all pages get the same header, footer etc...Are there best practice patterns for this?

Thanks.

MB.No problem here - - it all depends on what you want (code-wise) in your header/footer files...

If nothing is coded specific to (let's say) Classic ASP, then, you can just create include files and use them, just as you did in Classic ASP - -

if you want more robust functionality, that ASP.Net is good at - - then, you might want to look into creating a User Control for each, placing them wherever you'd like on the page.

here's a start for you , concerning UserControls:
http://aspnet101.com/aspnet/headfoot.aspx?code=/aspnet/headfoot.aspx - keep in mind, this is a VERY simple sample, just to give you a look at how it's done...
Thanks David.
David,

Having looked at the link, it is very simple and not very helpful. I am striving for a complex page structure. I want a header, a left panel, possibly a right panel, a footer and the main content in the middle of all this. Plus, I dont want to duplicate any code. As far as I can tell, I would need to create this structure and copy it into all the ASPX files, and simply embed user-controls for the actual HTML. But this doesnt seem very sophisticated. Surely there is a way of removing the duplication, yet retaining the ability to have complex structures defined in one place?

MB.

0 comments:

Post a Comment