how to access .skin file from aspx page - asp.net

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

Related

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

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" />

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" />

Changing CK editor filder

I created a asp.net web application and then I downloaded ckeditor. And I extracted my application directory this editor folder. And I added dll of ckeditor to reference of my application. I registered in my web page.
<add tagPrefix="CKEditor" assembly="CKEditor.NET" namespace="CKEditor.NET"/>
I can use ck editor as well. But when I put ckeditor to child folder, I didn't use ckeditor.
root
MyDefault.aspx
MyEditor
ckeditor folder
I want to use like this. How could I do that.
I used ckeditor in my website...
I set it rootforlder/js/ckeditor(folder)
I add below tag in page where I used ckeditor.
<%# Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
I used ckeditor control like below...
<CKEditor:CKEditorControl ID="ckService" runat="server" Height="200px" Width="400px" BasePath="~/js/ckeditor/"></CKEditor:CKEditorControl>
I hope this will help you... please, let me know.. if you want any help regarding it.

.skin vs .css from asp.net

What is the main difference between .skin and .css in asp.net?
.skin is new enhancement of IDE. I have been working with .css. What is available in .skin that is not to .css
thanks,
saj
In the skin file you can set properties of asp.net controls.
For example,
<asp:TextBox runat="server" Width="200"/>
All the TextBox controls in your application will have width 200.
You can give it a name and only the controls you like you can set them to apply a skin for example,
<asp:TextBox SkinID="MultiLineTextBox" runat="server" TextMode="MultiLine" Height="240"/>
now in a web page when adds TextBox control you can set its SkinID to be "MultiLineTextBox"
as the following,
<asp:TextBox runat="server" SkinID="MultiLineTextBox"/>
and thus it will inherit the TextMode as MultiLine and the Height as 240.
To use the skin you have to add a theme to your application under the App_Themes folder and there you add the skin file, now to use this theme in your pages you have to set the EnableTheming property of the page to true, StylesheetTheme or Theme to the name of your theme. You can also set this properties in the config file.
Setting the theme in the page aspx,
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" EnableTheming="true" StylesheetTheme="Your Theme Name" %>
Setting the theme in the web.config,
<configuration>
<system.web>
<pages styleSheetTheme="Your Theme Name"></pages>
</system.web>
</configuration>
Note that in terms of what these two things actually do there is a considerable difference. Any properties set in the .skin file are copied out to all of the page controls. An advantage to using Cascading Style Sheets is that the information is loaded and cached once. (and can be applied to multiple web pages.) Skin files can cause page bloat because all the properties set in the skin file must be merged with every affected control every time the page is rendered.
Additionally, the default behavior of the ASP.NET Theme .skin files is to override the properties of the controls being affected (this can be an unexpected behavior). For example, if you set the Width property for all ASP:Labels in your .skin file, all the ASP:Labels that use the skin file will have their Width properties set to that of the .skin file's regardless of the control's individual Width setting. To avoid this behavior, the ASP.NET StyleSheetTheme can be used to allow control-level properties to override the global .skin properties.
You can set some properties like Width even in CSS. Apart from being able to set properties that CSS cannot, there are some things you need .skin file for.
Consider an example where you need all the asp:Label controls on your page to be in blue color. A asp:Label is actually text inside a span, thats inside a hidden div. This is why we are able to set some properties like BackColor to this asp:Label and why the standard label control does not have a 'BackColor' property.
So, if you try to set font color to all ASP Labels through CSS,
then something like
Label {
color: Blue;
}
Will not work. On the other hand, using a skin file you can write
<asp:Label runat="server" ForeColor="Blue"></asp:Label>
and this will set all Labels to blue color.

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