Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET multiple pages with very similiar layout and logic

Reply
Thread Tools

ASP.NET multiple pages with very similiar layout and logic

 
 
Greg
Guest
Posts: n/a
 
      03-26-2007
I have a complex page (with 8 complex user controls, and many other
asp.net controls.) I have 2 very similiar pages to create, each page
differing only from the others in one control.

What is the best way to achieve this? I would guess that I have 3
alternatives.
1.) Visual and Logic inheritance. I know absolutely nothing about this
in ASP.NET, and I haven't found anything that appears immediately
simple ( i am in a rush to get this job done!).
2.) Have one page with all the controls on, and pass a parameter in
the request for the page informing it which identity it should assume
- i..e. if "PageA" is sent in the page request, the page should behave
like and contain the controls of a "PageA" type page, etc... This
would appear simple, though the different pages are to have different
security permissions - I intended for each page to be in its own
folder with the web.config file for that folder definining the access
rights for the logged in user. Having one page to do the work of 3
would mean that I would have to do the configration work in the top
level web.config file, which seems a bit more onerous.
3.) Put the contents of the page I have in now into a user control,
and put this user control into 3 different pages. My main worry about
this is the degree of processing overhead involved at the server,
since the control would be complex (many controls + 8 user controls
within it). However, it would mean that I could have 3 distinct pages
that I could more easily apply user access rights to.

I'm from a winforms background, so a lot of the concepts are quite new
to me - I'd appreciate any feedback on this.

Regards,

Greg.

 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      03-26-2007
"Greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...

> I'm from a winforms background, so a lot of the concepts are quite new
> to me - I'd appreciate any feedback on this.


Sounds like a prime candidate for MasterPages:
http://www.google.co.uk/search?sourc...%22+MasterPage

In a nutshell, MasterPages allow the main "look and feel" of a web app to be
written once only (in the MasterPage itself), and then indivual content
pages to be created which contain the bits which are different...

Prior to ASP.NET v2, this sort of functionality was commonly achieved with
user controls e.g. a user control for the header, a user control for the
menu, another for the sidebar, maybe another for the footer etc. References
to these controls needed to be added to each aspx page that required them.

MasterPages do away with all that. Once the MasterPage is created, simply
create a new content page and set its MasterPage property - job done.


 
Reply With Quote
 
 
 
 
Greg
Guest
Posts: n/a
 
      03-26-2007
On Mar 26, 11:28 am, "Mark Rae" <(E-Mail Removed)> wrote:
> "Greg" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) ups.com...
>
> > I'm from a winforms background, so a lot of the concepts are quite new
> > to me - I'd appreciate any feedback on this.

>
> Sounds like a prime candidate for MasterPages:http://www.google.co.uk/search?sourc...F-8&rls=GGLG,G...
>
> In a nutshell, MasterPages allow the main "look and feel" of a web app to be
> written once only (in the MasterPage itself), and then indivual content
> pages to be created which contain the bits which are different...
>
> Prior to ASP.NET v2, this sort of functionality was commonly achieved with
> user controls e.g. a user control for the header, a user control for the
> menu, another for the sidebar, maybe another for the footer etc. References
> to these controls needed to be added to each aspx page that required them.
>
> MasterPages do away with all that. Once the MasterPage is created, simply
> create a new content page and set its MasterPage property - job done.


Thanks Mark.

Under the given circumstances, what advantage would a master page have
over a user control?

The control that is different in the 3 pages is half way down the
page. Would it be necessary to have 2 master pages - i.e. one for the
top half of controls, and one for the bottom half, and the control
that is to be different in between?

Regards,

Greg.



 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      03-26-2007
"Greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...

> Under the given circumstances, what advantage would a master page have
> over a user control?


In fact, a MasterPage is nothing more than a user control anyway...

> The control that is different in the 3 pages is half way down the
> page.


OK.

> Would it be necessary to have 2 master pages - i.e. one for the
> top half of controls, and one for the bottom half, and the control
> that is to be different in between?


Not at all. The MasterPage would contain the "top half" and "bottom half".

The content pages would contain the content which changes.


 
Reply With Quote
 
=?Utf-8?B?U2FzaGlkaGFyIEtva2t1?=
Guest
Posts: n/a
 
      03-28-2007
There are 2 ways to achieve this with masterpages.

1. Have nested master-pages (one within another). You can choose the correct
master page to suit your needs then. The bad part about this is that you
won't have any designer support on this.
2. Have multiple contentplaceholder's in the same master page. That way, at
every page you can have complete control on what goes into the content, and
what gets inherited from the masterpage.

Having mutiple masterpages, for one page is kind of a bad way to program for
uniform look and feel. I suggest in your case, you may as well use multiple
contentplaceholder's in the same masterpage.

Regarding the advantage of masterpages over user-controls, well...all i
know/can say about masterpages is that its optimized , since its a part of
the framework. In the past, I have created the master-page as a usercontrol
(in asp.net 1.1), and the drawback in my code was that for some reason, it
took longer to render each time, and there was less of
programmer-friendliness.

Hope that helps,

--
Sashidhar Kokku
ikaSystems Corp


"Greg" wrote:

> On Mar 26, 11:28 am, "Mark Rae" <(E-Mail Removed)> wrote:
> > "Greg" <(E-Mail Removed)> wrote in message
> >
> > news:(E-Mail Removed) ups.com...
> >
> > > I'm from a winforms background, so a lot of the concepts are quite new
> > > to me - I'd appreciate any feedback on this.

> >
> > Sounds like a prime candidate for MasterPages:http://www.google.co.uk/search?sourc...F-8&rls=GGLG,G...
> >
> > In a nutshell, MasterPages allow the main "look and feel" of a web app to be
> > written once only (in the MasterPage itself), and then indivual content
> > pages to be created which contain the bits which are different...
> >
> > Prior to ASP.NET v2, this sort of functionality was commonly achieved with
> > user controls e.g. a user control for the header, a user control for the
> > menu, another for the sidebar, maybe another for the footer etc. References
> > to these controls needed to be added to each aspx page that required them.
> >
> > MasterPages do away with all that. Once the MasterPage is created, simply
> > create a new content page and set its MasterPage property - job done.

>
> Thanks Mark.
>
> Under the given circumstances, what advantage would a master page have
> over a user control?
>
> The control that is different in the 3 pages is half way down the
> page. Would it be necessary to have 2 master pages - i.e. one for the
> top half of controls, and one for the bottom half, and the control
> that is to be different in between?
>
> Regards,
>
> Greg.
>
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Choosing Layout: Css-Layout or Table-Layout hpourfard@gmail.com ASP .Net 1 06-19-2006 10:06 AM
Optimize function similiar to dict.update() but adds common values =?ISO-8859-1?Q?Gregory_Pi=F1ero?= Python 10 12-15-2005 05:06 PM
New VoIP Free Software, similiar to skype but also very good quality. NEP VOIP 0 10-19-2005 12:43 PM
Connect SQL to Outlook, similiar to Sharepoint? David Lozzi ASP .Net 0 07-23-2005 05:29 PM
Anything faster than Saxon with similiar features? ted XML 1 02-16-2004 05:43 AM



Advertisments