Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 27th, 2013, 06:59 AM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default Themes question

Hi Imar,

With your section on themes, what do you think is the best approach if I have an old website that has no master page and all pages/control pages have a link to a css file, should I use website level theme in pages section of web.config? Or can I use your basepage example and edit all those pages to inherit in this web page?

Basically I will have 2 css files and I want to switch between those 2 CSS files depending on what is defined in the web.config setting, something similar to your example on switching themes, but only, my pages were developed using asp.net 2.0 and no content pages/master pages.

Thanks
Reply With Quote
  #2 (permalink)  
Old May 27th, 2013, 04:49 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Do your existing pages have something in common like a base page or a shared user control? That would make it easier to centralize the theme switching.

Otherwise, I think the Base Page is probably the best way to solve this.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old May 28th, 2013, 03:26 AM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Hi Imar,

There are 2 bases, one is used for control pages (ascx) inheriting from ui.usercontrol, and the other is base for standard pages (aspx) inheriting from ui.Page. I guess I'll have to use the base for ui.page, right? since control pages reside in web pages anyway?

Also, there might be an overhead in performance as I will have to put a runat attribute in head tag of all pages.

Thanks again
Reply With Quote
  #4 (permalink)  
Old May 28th, 2013, 10:35 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Quote:
and the other is base for standard pages (aspx) inheriting from ui.Page.
Is this the standard System.Web.UI.Page that all your pages inherit from? Or do yo have an intermediate class between System.Web.UI.Page and your Web Forms?

Quote:
guess I'll have to use the base for ui.page, right? since control pages reside in web pages anyway?
It depends. If you have a User Control inside the <head> of each page, you could also use that to implement the style switcher.

What you're looking for is something that is already reused across all of your pages, making the switch much easier.

Quote:
Also, there might be an overhead in performance as I will have to put a runat attribute in head tag of all pages.
I wouldn't worry about that. I doubt you could even measure the difference.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
janilane (May 30th, 2013)
  #5 (permalink)  
Old May 28th, 2013, 05:21 PM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Hi Imar,

Yes, it is the standard System.web.ui.page namespace.

I'll find the user control base then, thanks for the input.

cheers

EDIT:

In the future when the business decides to use a master page instead, is it possible to introduce a master page on a normal aspx page and not content page? Do you have an article on that or any link that I could use to apply to that next project? Thanks again.

Last edited by janilane; May 28th, 2013 at 06:03 PM..
Reply With Quote
  #6 (permalink)  
Old May 29th, 2013, 11:29 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
I'll find the user control base then, thanks for the input.
Not sure I get this. If you have a single User Control on all your pages, you don't need a UC base, you can simply implement it in the user control itself.
The point I am making is that you should find a central point that is used by your pages. If that's a shared UC: great. Otherwise, modifying the pages to inherit a common base page is the next alternative.

Quote:
is it possible to introduce a master page on a normal aspx page and not content page?
A content page is a web form, but with a slightly different @page directive (referencing the master page) and without the shared HTML that is now placed in the master page. There is no tool in Visual Studio that can help you with the conversion. It's not difficult to do it manually (mostly deleting stuff) but it can be time consuming. There might be tools out there that can help you with this but I am not sure.....

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
janilane (May 30th, 2013)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 - Themes jmartin BOOK: Beginning ASP.NET 4 : in C# and VB 7 February 11th, 2012 04:25 PM
chapter 6 themes ajayreddy28390 BOOK: Beginning ASP.NET 4 : in C# and VB 1 December 19th, 2011 08:13 AM
Themes SP2010Dude BOOK: Beginning ASP.NET 4 : in C# and VB 1 September 17th, 2010 02:01 AM
Use Themes? the.pi.man ASP.NET 2.0 Basics 2 March 7th, 2007 08:44 AM
Themes bmains ASP.NET 2.0 Basics 2 August 2nd, 2004 08:48 AM



All times are GMT -4. The time now is 03:17 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.