473,386 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ASP.NET multiple pages with very similiar layout and logic

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.

Mar 26 '07 #1
4 1834
"Greg" <sp**********@yahoo.co.ukwrote in message
news:11*********************@p15g2000hsd.googlegro 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.
Mar 26 '07 #2
On Mar 26, 11:28 am, "Mark Rae" <m...@markNOSPAMrae.comwrote:
"Greg" <spammesil...@yahoo.co.ukwrote in message

news:11*********************@p15g2000hsd.googlegro 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.

Mar 26 '07 #3
"Greg" <sp**********@yahoo.co.ukwrote in message
news:11**********************@b75g2000hsg.googlegr 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.
Mar 26 '07 #4
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" <m...@markNOSPAMrae.comwrote:
"Greg" <spammesil...@yahoo.co.ukwrote in message

news:11*********************@p15g2000hsd.googlegro 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.

Mar 28 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ghadley_00 | last post by:
MS Access Create form / report with multiple pages using different background images Hi, Would like to have users fill out a multipage form, and then click a print button, which pulls up the...
4
by: Jay | last post by:
Still can't seem to find a solution to printing a lengthy datagrid on multiple pages including datagrid headeron each page. I am not using Crystal Reports or Reporting Services or VStudio. Any...
2
by: ray well | last post by:
hi, i need to print multiple pages on a printer. this is what i'm using now Sub Print() Dim PrintDoc As New PrintDocument AddHandler PrintDoc.PrintPage, AddressOf Me.PrintText Do While...
1
by: mark | last post by:
I can't seem to get the logic for printing multiple pages. I know I have to do a comparison between the bottom margin and the position of the next line to be printed and initiate a has more pages...
4
by: m.shidoshi | last post by:
I was recently put in charge of heading up my company's website, and while I have a lot of experience on the design side of things, I'm still very new to the programming side. When I started, the...
3
by: Raphas | last post by:
Hi, there are a lot of different scripts out there to sort a table with multiple columns. However, I want to do something specific. I have a table that is "spread" accross multiple pages....
2
by: Matthew Kitchin \(Usenet/Lists\) | last post by:
Hello, I've got multiple pages on the same server that all have the same drop down boxes in them. It is a list of all our facilities. Every time there is a change, I have to change it on every...
0
by: raj3109 | last post by:
Hi experts, I’d like to have some helps from you guys. I need to create an app with C# and Crystal Report.Net using VS 2008 for a Landscape & Nursery company. The company will send out coupon...
3
by: deames | last post by:
I have an access report that combines project data with project planning considerations. It includes several sub reports and VBA coding on the on print function to print lines between the different...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.