473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

using Css and master page

I have created a master page
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
Expand|Select|Wrap|Line Numbers
  1.  
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head runat="server">
  6. <title>Untitled Page</title>
  7. </head>
  8. <body>
  9. <form id="form1" runat="server">
  10. <div>
  11. <h1 style="color:blue">This is From Master page</h1>
  12. <table width="80%">
  13. <tr valign="top">
  14. <td style="width:200px">
  15. to:do
  16. </td>
  17. <td>
  18. <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
  19. </asp:contentplaceholder>
  20. </td>
  21. </tr>
  22. </table>
  23.  
  24. </div>
  25. </form>
  26. </body>
  27. </html>
  28.  
then i used that master page in my .aspx pages as
Expand|Select|Wrap|Line Numbers
  1.  
  2. <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master" CodeFile="Default.aspx.cs" Inherits="_Default" %>
  3.  
  4.  
  5. <asp:Content ID="content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
  6.  
  7. <asp:Label runat="server" ID="lbl1" Text="User Name" style="position:absolute; left: 265px; top: 130px;"></asp:Label>
  8. <asp:TextBox runat="server" ID="txt1" style="position:absolute; left: 385px; top: 130px;"></asp:TextBox>
  9. <br />
  10. <asp:Label runat="server" ID="Lbl2" Text="password" style="position:absolute; left: 265px; top: 160px;"></asp:Label>
  11. <asp:TextBox runat="server" ID="txt2" style="position:absolute; left: 385px; top: 160px;"></asp:TextBox>
  12. </asp:Content>
  13.  
all these work fine but if I need to add a style sheet to my aspx page I am not able to do so because I am not able to get the tag of <link> which is used to link a css to our page how has it to be done?
any clues????

raghul
Jul 4 '08 #1
1 1309
Hi,

you must link your css file in teh master page itself, so that when you inherit the master page when you creating a page the stylesheet applied with the master page will be applied to your created pages also

you can attach the css file in the master pages using the <link> tag

you can use this tag in the <head> section

<link href="your stylesheet name with location" rel="stylesheet" type="text/css" />

you should move all your styles to a seperate stylesheet file(.css) so that it is easy to change if ther is any changes in the style

if you change the style in the stylesheet it will be applied to all your pages

Thanks,
Hema
Jul 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jurrie | last post by:
Hi all, I use apaches FOP to translate an XML-document into a PDF-document. I use repeatable-page-master-alternitives, but FOP gives some strange errors: Unsupported element encountered:...
10
by: George G. | last post by:
Hi there, I am busy writing a new asp.net application and I am reusing some of my existing asp functions and methods in a user control. I need access to session, request and response in some of...
17
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
1
by: Don | last post by:
I'm using master pages and have added some base functionality (public functions) into this class. I then create a new web form using the above as the master page. In the code of my new web form,...
9
by: RBM007 | last post by:
Hello, I have created some pages in the (old) Atlas pages and migrated to AJAX version. After the update I noticed that any page containing ASP.NET AJAX won't compile anymore. Even if the same...
0
by: dixonjm | last post by:
Hi, I have a master page & various pages that will use this master page. Each content page will have a CSS & JS file which will be named the same as the content page. When I try to load the CSS...
6
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %>...
10
by: =?Utf-8?B?RGFuaQ==?= | last post by:
Hi, Trying to create a master page that holds a menu, and the menu switches between pages in the site. 2 problem arrosed: a. When I navigate from page to page (all AJAX Web Forms, with the...
8
by: =?Utf-8?B?Q2hyaXMgSGFsY3Jvdw==?= | last post by:
Hi there I've successfully added some .NET validation controls to a page (using <asp:RequiredFieldValidator ...), however when I try to set the 'display' property to 'dynamic', my page then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.