How to use .skin file present in a folder under Theme folder? - asp.net

friends...
I want to use skin file "Black.skin" which is present in a folder "Skins" under theme's folder "Black_Theme" as shown folder structure in below fig.
In .aspx page, I am using
<%# Page StylesheetTheme="Black_Theme"
and in body, I am using skin file as
<asp:Button ID="btn" runat="server" Text="Click Me" />
<asp:Button ID="Button1" runat="server" Text="Click Me" SkinID="yellow" />
But When I run and check output, page is rendered as no skin applied.
So, some how skin file is not applied.
When I move skin file to theme's folder, it works as expected.
So, I need to give reference of skin file in a folder under theme's folder.
How to use .skin file present in a folder under Theme folder ?
Thanks in advance.

Set Value of theme Properties in Pages tag in Web.Config File
like < pages theme="default" />

Related

Video is not playing in asp.net web page

I downloaded a media player control from the Net then added in my toolbox. Then I drag-and-dropped it to my web page but it's not working...
cc1:Media_Player_Control ID="Media_Player_Control1" runat="server"
MovieURL="./video/yaarian.wmv"
this is my code
Make sure that the path is correct
e.g.
remove ./ if video is located in the child folder named video
or use absolute path e.g. /pages/video/yaarian.wmv
Check the control registration tag and make sure you have the assembly loaded in your bin folder:
<%# Register TagPrefix="cc1" Namespace="MyApp.Controls" Assembly="MyApp" %>
Then, try the following:
<cc1:Media_Player_Control ID="Media_Player_Control1" runat="server"
MovieURL="~/video/yaarian.wmv" runat="server" />

Asp.Net - Apply a Skin to a Button inside a Custom User Control

I use Asp.Net 4 and C#.
In my web site I have a Theme Folder with a Skin file to changing the aspects of all my Button in my website.
All is working fine except styling for a Button inside a User Control.
Do you have an idea how to apply the skin file even to the Button inside the User Control? Thanks for your help!
SKIN FILE:
<asp:Button runat="server" ForeColor="#ffffff" BackColor="#627AAD" Font-Bold="True" BorderColor="#000000" BorderWidth="1px"/>
ON .ASPX:
<%# Register Src="~/UploadImageColorPicker.ascx"
TagName="UploadImageColorPicker" TagPrefix="cms" %>
<cms:UploadImageColorPicker ID="uxUploadImageColorPicker" runat="server" />
You need to set Theme="ThemeName" at page directive in which you have add add user control

how to access .skin file from aspx page

i have a .skin file inside my app.themes folder. To access .css file from asp page we have to give link. but i couldn't find any thing on asp header to give link for .skin file.
<asp:TextBox SkinID="txtBox" ID="TextBox1" runat="server"></asp:TextBox>
i got the following error..
A SkinID has been specified but the page is not configured to use a page theme or stylesheet theme. This is acceptable if the theme or stylesheet theme will be set programmatically.
should i create any link?
thanks
saj
Should specify the name of the theme (ie the folder in your App_Themes folder that contains your skin file) on the Theme property of the Page.
In code:
Page.Theme = "MyTheme"
or in your markup:
<%# Page Theme="MyTheme" .... %>
Don't use ID="TextBox1" in any skin file

Relative Path in master page for img tag

I have a tag in a master page.
I use this master page in many folders. So the src path of the tag should be different for each folder.
Here is my code :
<img src="images/1.gif" />
and I have a folder named "images" and a folder named "Users".
Master Page is in the root, but I use it in Users folder.
How can I set a dynamic address for src?
The easiest way would be to use an asp:Image tag. You need to add runat="server" in order to use ~ syntax to resolve your URLs.
<asp:Image ID="myImage" runat="server" ImageUrl="~/images/1.gif" />
Just use <img runat="server" src="~/images/1.gif" />. This is documented here.

ASP.NET 2.0: Skin files only work when placed at the root theme folder?

I have found that skin files only work if they are placed at the root theme folder in the App_Themes folder.
For example, if you have 2 themes in the App_Themes folder, you cannot add another sub folder to the theme folder and place a seperate skin file in that subfolder.
It's not much of a limitation, but it would give you more flexibility to further customize an app.
Can anyone shed light on why this behavior occurs as it does in 2.0?
Has your skin file should have the extension .skin? I always call them theme.skin and give them the same name as the folder. Eg in Theme col2, the folder is
App_Themes\col2
and contains the css and col2.skin
Microsoft is your best reference:
Themes in ASP.Net don't provide the ability to choose from "sub-themes".
However, you can set SkinIDs in your skin files. For example, in your .skin :
<asp:DataList runat="server" SkinID="DataListColor" Width="100%">
<ItemStyle BackColor="Blue" ForeColor="Red" />
</asp:DataList>
<asp:DataList runat="server" SkinID="DataListSmall" Width="50%">
</asp:DataList>
Then, when you want to call one of them, you just specify which SkinID you want for your datalist.
The only way to change this behavior is via a VirtualPathProvider - something along the lines of:
http://www.neovolve.com/page/ASPNet-Virtual-Theme-Provider-10.aspx

Resources