Setting stylesheet property for web form

  • Thread starter Alex. O. Koranteng
  • Start date
A

Alex. O. Koranteng

I have added my skin file to the App_theme folder of my app. I have
referenced stylesheet name as shown below. Any suggestions will be appreciated

<%@ Page Language="C#" MasterPageFile="~/AJAX_MasterPages/MainMaster.master"
AutoEventWireup="true" CodeFile="MainContent.aspx.cs"
StylesheetTheme="~/main.css" Inherits="MainContent" Title="Untitled Page" %>



I am getting the error below

Server Error in '/AJAXANDMASTERPAGES' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: '~/main.css' is not a valid theme name.

Source Error:


Line 1: <%@ Page Language="C#"
MasterPageFile="~/AJAX_MasterPages/MainMaster.master" AutoEventWireup="true"
CodeFile="MainContent.aspx.cs" StylesheetTheme="~/main.css"
Inherits="MainContent" Title="Untitled Page" %>
Line 2:
Line 3:


Source File: /AJAXANDMASTERPAGES/AJAX_MasterPages/MainContent.aspx Line: 1
 
A

Allen Chen [MSFT]

Hi Alex,

Please try following steps to learn how to apply themes:

1. Create a new ASP.NET Web Application project.

2. Right click the project node in the solution explorer window, select
Add-> New Item...

3. Find the Skin File icon in the Templates, select it and click Add button.

4. You'll see a popup window. Click Yes.

5. Paste following code in Skin1.skin:
<asp:label runat="server" font-bold="true" forecolor="orange" />

6. Paste following code in Default.aspx:
<asp:Label ID="Label1" runat="server" Text="Hello 1" /><br />
<asp:Label ID="Label2" runat="server" Text="Hello 2" ForeColor="blue"
/>

7. Add StylesheetTheme for the Page (in Default.aspx):
<%@ Page StylesheetTheme="Skin1" ...

8. Start debugging. You'll see a orange Label and blue one.

Note here the Skin1 set for StylesheetTheme is the name of the folder under
the App_Themes folder. The Skin1 folder represents the theme name.

For more details please refer to:
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/themes/stylesheettheme.a
spx

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Alex. O. Koranteng

Allen,

Thanks for your code suggestions. I attempted to recreate the steps outlined
and that work. Hiowever on my sample demo app, things are not working. Is it
because my stlesheet is derived from a css file as opposed to a skin file as
demonstrated in your code sample. I have attached my project and sent to your
email inbox for you to take a look at for me.
 
A

Allen Chen [MSFT]

Hi Alex,
Hiowever on my sample demo app, things are not working.

Could you tell me what do you mean by "things are not working"? When I
tested your code I get an exception:

The file '/AJAX_MasterPages/AJAX_MasterPages/MainMaster.master' does not
exist.

Do you mean this exception?

If so this is because that the master page path is incorrect:

<%@ Page Language="C#" MasterPageFile="~/AJAX_MasterPages/MainMaster.master"

The correct one is:

<%@ Page Language="C#" MasterPageFile="~/MainMaster.master"

After the above change it seems everything works fine. Could you test it to
see if it works?

Regards,
Allen Chen
Microsoft Online Support
 
A

Alex. O. Koranteng

Allen,

Thanks for your response. I implemented your code suggestion and i am
getting these errors:

The file '/AJAXANDMASTERPAGES/MAINMASTER.MASTER does not exist
Theme 'Default' cannot be found in the application diectory or global theme
directory
Invalid theme stylesheet name

This is my page declaration with your changes:

<%@ Page Language="C#" MasterPageFile="~/MainMaster.master"
AutoEventWireup="true" CodeFile="MainContent.aspx.cs"
StylesheetTheme="Default" Inherits="MainContent" Title="Untitled Page"
Theme="Default" %>
 
A

Allen Chen [MSFT]

Hi Alex,
The file '/AJAXANDMASTERPAGES/MAINMASTER.MASTER does not exist
Theme 'Default' cannot be found in the application diectory or global theme
directory
Invalid theme stylesheet name

Could you send your current project to me?

Regards,
Allen Chen
Microsoft Online Support
 
A

Alex. O. Koranteng

Allen,

I am forwarding it to your inbox in a few minutes. Thanks for your patience.
 
A

Alex. O. Koranteng

Allen,

I have been able to get the application to work. I used your code suggestion
from the previous thread. I was missing the javascript file in my page and it
worked after I added it. Thanks for all your support and patience.
 
A

Allen Chen [MSFT]

I have been able to get the application to work. I used your code
suggestion
from the previous thread. I was missing the javascript file in my page and it
worked after I added it. Thanks for all your support and patience.

Glad to know that.

Thank you for using our Newsgroup Support Service!

Regards,
Allen Chen
Microsoft Online Community Support



=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
=================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top