Hi,
I have created a user control and apply a style sheet on it as under:
<%@ Control Language="C#"%>
<link href="StyleSheet.css" rel="stylesheet" type="text/css"/>
<asp:CheckBox ID="CheckBox1" runat="server"/>
div>
When i add this user control on my asp.net web forms style shet will not apply. I don't want to add reference of stylesheet file in my asp.net page
Pls. help me.
Thanks
Rohit KesharwaniPosted Oct 18, 2011, 8:22 AM
.a1
UserControl(.ascx)
<%
@ Control Language="C#" %><
<
link href="~/Base/StyleSheet.css" rel="stylesheet" type="text/css" />div class="a1">
<asp:CheckBox ID="CheckBox1" Text="Hello" runat="server" />div>Web page:
<%
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>@ Register src="~/Base/UserControl.ascx" tagname="UserControl" tagprefix="uc1" %><
<
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">html xmlns="http://www.w3.org/1999/xhtml">head runat="server"><
<title>title>head>body>
<form id="form1" runat="server">
<div>
<uc1:UserControl ID="UserControl1" runat="server" />
div>
form>body>html>{width:200px;border-style:solid;font-weight:bold;
}
Hemant KumarPosted Oct 18, 2011, 8:07 AM
you need to add the reference of the StyleSheet in the control only.It is not mandatory to add in the webPage also.
Please check this .If any problem share your code also.