Click here to Skip to main content
15,886,518 members
Articles / Web Development / HTML

Changing Page Style for Printing

Rate me:
Please Sign up or sign in to vote.
3.19/5 (9 votes)
17 Aug 20062 min read 46.4K   787   36  
Using a stylesheet to change the page style for printing.
<%@ Page language="c#" Codebehind="frmStyleDisplay.aspx.cs" AutoEventWireup="false" Inherits="PageStyle.frmStyleDisplay" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title></title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="C#" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<LINK title="MainStyles" href="styles/DefaultStyles.css" type="text/css" rel="stylesheet">
		<LINK title="PrintStyles" media="print" href="styles/Print.css" type="text/css" rel="stylesheet">
	</HEAD>
	<body bgColor="#33cc66" MS_POSITIONING="GridLayout">
		<form id="Form1" method="post" runat="server">
			<table class="clsBorderDouble" height="40%" width="60%" align="center">
				<tr>
					<td width="20%"></td>
					<td class="clsTitle" width="20%">Bosh Tech</td>
					<td width="20%"></td>
				</tr>
				<tr>
					<td colSpan="3">
						<DIV id="SearchCriteria">
							<TABLE cellSpacing="2" cellPadding="0" width="100%" border="0">
								<TR>
									<TD class="clsFieldLabel" width="15%">&nbsp;Cust ID</TD>
									<TD><INPUT class="clsFieldData" id="txtHRBEmpId" type="text" maxLength="10" size="10" name="Amt"
											runat="server">
									</TD>
									<TD class="clsFieldLabel" width="15%"></TD>
									<TD class="clsFieldLabel"></TD>
								</TR>
							</TABLE>
							<TABLE cellSpacing="2" cellPadding="0" width="100%" border="0">
								<TR width="100%">
									<TD vAlign="bottom" align="right" width="49%"><ASP:BUTTON id="ButtonReset" runat="server" cssclass="clsBtnControl" text="Reset"></ASP:BUTTON></TD>
									<TD width="2%">&nbsp;</TD>
									<TD vAlign="middle" align="left" width="49%"><ASP:BUTTON id="ButtonSearch" runat="server" cssclass="clsBtnControl" text="Search"></ASP:BUTTON></TD>
								</TR>
							</TABLE>
						</DIV>
					</td>
				</tr>
				<tr>
					<td colSpan="3">
						<div class="print" id="header">
							<TABLE height="auto" cellSpacing="0" cellPadding="0" width="98%" align="center" border="0">
								<TR class="clsBackGroundLight">
									<TD>
										<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
											<TR>
												<TD class="clsFieldLabelReport" align="center"><ASP:LABEL id="_subheading1" runat="server" enabled="False"></ASP:LABEL></TD>
											</TR>
											<TR>
												<TD class="clsFieldLabelReport" align="center"><ASP:LABEL id="_subheading2" runat="server" enabled="False"></ASP:LABEL></TD>
											</TR>
											<TR>
												<TD class="clsFieldLabelReport" align="center"><ASP:LABEL id="_subheading3" runat="server" enabled="False"></ASP:LABEL></TD>
											</TR>
											<TR>
												<TD class="clsFieldLabelReport" align="center"><ASP:LABEL id="_subheading4" runat="server" enabled="False"></ASP:LABEL></TD>
											</TR>
										</TABLE>
										<DIV></DIV>
									</TD>
								</TR>
							</TABLE>
						</div>
					</td>
				</tr>
				<tr>
					<td colSpan="3">
						<div id="detail">
							<table style="WIDTH: 576px; HEIGHT: 150px">
								<TBODY>
									<tr>
										<td><ASP:DATAGRID id="DataList" runat="server" Height="125px" Width="568px" borderwidth="0" bordercolor="white"
												borderstyle="Solid" cellspacing="0" cellpadding="0">
												<ITEMSTYLE CSSCLASS="clsTableRow" VerticalAlign="Top"></ITEMSTYLE>
												<ALTERNATINGITEMSTYLE CSSCLASS="clsTableRowAlternate"></ALTERNATINGITEMSTYLE>
												<HEADERSTYLE cssclass="clsNormalBold"></HEADERSTYLE>
											</ASP:DATAGRID></td>
									</tr>
									<TR>
										<td>
											<div class="print" id="footer">
												<table style="WIDTH: 576px; HEIGHT: 39px">
													<TR>
														<TD class="clsNormal" align="left" width="50%">Printed By:
															<ASP:LABEL id="_printedBy" runat="server"></ASP:LABEL></TD>
														<TD class="clsNormal" align="right" width="50%">Date:
															<ASP:LABEL id="_printedOn" runat="server"></ASP:LABEL></TD>
													</TR>
												</table>
											</div>
										</td>
									</TR>
								</TBODY>
							</table>
						</div>
					</td>
				</tr>
			</table>
			<TABLE cellSpacing="2" cellPadding="0" width="60%" align="center" border="0">
				<TR width="100%">
					<TD vAlign="bottom" align="left" width="50%"><INPUT class="clsBtnControl" id="btnYes" type="button" value="Continue"></TD>
					<TD vAlign="middle" align="right" width="50%"><INPUT class="clsBtnControl" id="btnNo" type="button" value="Cancel" name="btnNo"></TD>
				</TR>
			</TABLE>
			<DIV></DIV>
			</TR></TABLE></form>
	</body>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
I am Roopesh Rajendran, I have 3 + years expirience in asp.net C#. Currently i am working in U S Technology Techopark.i am an ative member in Code project,.net spider,Expert Exchange....
i have MCP's in C# web,XML Web service, % brain bech certifications...published lot of articles in Code project..


Comments and Discussions