|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ASP.NET multiple pages with very similiar layout and logicasp.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. "Greg" <spammesilly1@yahoo.co.uk> wrote in message Sounds like a prime candidate for MasterPages:news:1174903621.712303.91230@p15g2000hsd.googlegroups.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. http://www.google.co.uk/search?sourceid=navclient&ie=UTF-8&rls=GGLG,GGLG:2006-28,GGLG:en&q=%22ASP%2eNET%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.
Show quote
On Mar 26, 11:28 am, "Mark Rae" <m...@markNOSPAMrae.com> wrote: Thanks Mark.> "Greg" <spammesil...@yahoo.co.uk> wrote in message > > news:1174903621.712303.91230@p15g2000hsd.googlegroups.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?sourceid=navclient&ie=UTF-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. 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. "Greg" <spammesilly1@yahoo.co.uk> wrote in message In fact, a MasterPage is nothing more than a user control anyway...news:1174924020.565257.222690@b75g2000hsg.googlegroups.com... > 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 OK.> page. > Would it be necessary to have 2 master pages - i.e. one for the Not at all. The MasterPage would contain the "top half" and "bottom half".> top half of controls, and one for the bottom half, and the control > that is to be different in between? The content pages would contain the content which changes. 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, -- Show quoteSashidhar Kokku ikaSystems Corp "Greg" wrote: > On Mar 26, 11:28 am, "Mark Rae" <m...@markNOSPAMrae.com> wrote: > > "Greg" <spammesil...@yahoo.co.uk> wrote in message > > > > news:1174903621.712303.91230@p15g2000hsd.googlegroups.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?sourceid=navclient&ie=UTF-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. > > > > |
|||||||||||||||||||||||