 |
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category.
** PLEASE BE SPECIFIC WITH YOUR QUESTION **
When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

October 1st, 2004, 12:33 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Setting Theme in Master Page
VS.NET 2005 BETA.
I have moved this topic from the VS.NET Beta forum.
Hi all,
Im playing around with themes and have succesfully implemented the feature for pages.
However I want to be able to set the theme in the MasterPage rather than on all content pages.
I can not seem to get the Page_PreInit to fire for a master page.
And the <@ Master> does not have a theme attribute
It does not seem likely after all the effort microsoft has gone to to establish master pages and themes that you would need to set this on every content page.
Any Suggestions?
======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
|

October 1st, 2004, 01:57 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I am not sure whether you can set a theme for a Master page or not.
However, if the purpose of this is to apply the theme to the entire site, there is good news. Try this in your Web.Config:
<system.web>
<pages theme="MySuperCoolTheme" />
<system.web>
I know it's not as useful as applying it to the master page, but at least it's better than applying it to each individual page.
You can even set the theme for the entire server by changing the Machine.Config.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Cicatriz Esp by The Mars Volta (Track 7 from the album: De-loused in the Comatorium) What's This?
|

October 2nd, 2004, 01:39 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Thank Imar,
I was hoping to provide a different theme for different users, in fact for different HTTP_HOST's.
I guess it's every page then.
This is quite strange as there is a 'EnableThemes' attribute to the MasterPage.
This must be evaluated before or on the Page_PreInit, would you agree.
======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
|

October 2nd, 2004, 03:03 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I am not sure about that. If you want to programmatically change the theme, you have to change the theme in the Page_PreInit event of the page. However, code in the master page seems to fire after the code in the page that is based on the master, so I wouldn't be surprised if you can still disable the theme in a later event in the master page.
I can't really test it here right now; for some reason my themes do not even show up on the page, whether I set the theme in the page or in the Wen config. Something must be broken.... ;-(
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|

October 2nd, 2004, 03:40 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Thanks again Imar.
Even without setting in Master, Im quite impressed with this enhancement.
======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
|

October 2nd, 2004, 05:02 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right, I figured out what went wrong with my themes. It looks like the installation of Crystal Reports screwed up my themes. Here's what's inside my skin file for the SmokeAndGlass theme:
Code:
<%@ register tagprefix="cr" namespace="CrystalDecisions.Web"
assembly="CrystalDecisions.Web, Version=9.7.3500.0, Culture=neutral,
PublicKeyToken=692fbea5521e1304" %>
<%@ register tagprefix="crtheme" namespace="CrystalDecisions.Shared"
assembly="CrystalDecisions.Shared, Version=9.7.3500.0, Culture=neutral,
PublicKeyToken=692fbea5521e1304" %>
<cr:crystalreportviewer runat="server" autodatabind="true"
grouptreeimagesfolderurl="images/tree/"
grouptreestyle-showlines="False"
grouptreestyle-Font-Size=".9em"
grouptreestyle-Font-Names="Verdana"
grouptreestyle-BackColor="#FFFFFF"
grouptreestyle-Font-Bold="True"
BorderStyle="Double"
BorderColor="#E7E5DB"
Font-Size=".9em"
Font-Names="Verdana"
Font-Weight="Bold"
ForeColor="#585880"
BackColor="#F8F7F4"
cssfilename="SmokeAndGlass_CR.css"
></cr:crystalreportviewer>
This doesn't look right, does it?
I think that somehow at installation time, the CR installation messed up the files. In the mean time I restored the original *.skin files, and things are working again now.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: What You Are by Audioslave (Track 4 from the album: Audioslave) What's This?
|

April 9th, 2008, 01:53 AM
|
Authorized User
|
|
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
I've applied the themes in the preinit event but I am facing a problem... I am having 7 buttons for 7 different themes but the event is handled by a single event handler. I am assigning the theme to a session and when the page is postbacked, I am applying the theme, but when I am clicking on the button for the second time, then only the theme is applied... any solutions??? Thanks in advance...
Thanks and Regards,
Senthil Kumar M.
|

April 9th, 2008, 02:44 AM
|
Authorized User
|
|
Join Date: Dec 2004
Posts: 69
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Button event contains
Protected Sub ApplyTheme(ByVal sender As Object, ByVal e As EventArgs) Handles btnViolet.Click, btnIbrow.Click, btnBlue.Click, btnGreen.Click, btnyellow.Click, btnOrange.Click, btnRed.Click
Dim b As Button
b = CType(sender, Button)
Select Case (b.CommandName)
Case "Violet"
Session("Theme") = "Violet"
Case "Ibrow"
Session("Theme") = "Ibrow"
Case "Blue"
Session("Theme") = "Blue"
Case "Green"
Session("Theme") = "Green"
Case "Yellow"
Session("Theme") = "Yellow"
Case "Orange"
Session("Theme") = "Orange"
Case "Red"
Session("Theme") = "Red"
Case Else
Session("Theme") = "White"
End Select
end sub
preinit event contains
Dim _theme As String = "White"
If (Session("Theme") IsNot Nothing) Then
_theme = Session("Theme").ToString()
else
_theme="White"
End If
page.theme=_theme
if i am clicking the button for the second time then only the theme is applied...
Thanks and Regards,
Senthil Kumar M.
|
|
 |