bertino12
asked on
Printing html in asp .net master pages
I have a page that uses a master page and want to just print an HTML table, not the master pages stuff. HOw can I do this?
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Sheet.aspx.vb" Inherits="Project1.Sheet" masterpagefile="~/Site.mas ter" smartnavigation="True"%>
<asp:content id="Content1" contentplaceholderid="Cont entPlaceHo lder1" runat="server">
<table>just print this table</table>
</asp:content>
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Sheet.aspx.vb"
<asp:content id="Content1" contentplaceholderid="Cont
<table>just print this table</table>
</asp:content>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you'd have to put the link in your master page...
keep in mind the styles in print.css will only be applied when you try to print the page because of the media="print" part
keep in mind the styles in print.css will only be applied when you try to print the page because of the media="print" part
ASKER
Well the problem is my master page looks like this.
<table style="width: 98%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td style="width: 100%; height: 29; background-image: url(images/row.gif); font-weight: bold;" colspan="2">
Admin
</td>
</tr>
<tr>
<td style="width: 70%; background-color: #dcdcdc; height: 23px; text-align: left; color: #000000; font-family: 'Times New Roman';">
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default.asp x" Style="left: 0px;
position: relative">Home</asp:HyperL ink> -
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/Schedule.as px" Style="position: relative">Schedule</asp:Hy perLink> -
<asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/Class.aspx" Style="position: relative">Classes</asp:Hyp erLink> -
<asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="~/Reports.asp x" Style="position: relative">Reports</asp:Hyp erLink>
</td>
<td style="width: 30%; background-color: #dcdcdc; height: 23px; text-align: right; color: #000000; font-family: 'Times New Roman';">
</td>
</tr>
<tr style="font-size: 12pt">
<td align="left" colspan="2" style="width: 90%; background-color: #dcdcdc; font-size: 12px; font-family: Arial; height: 18px; color: Black">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td align="left" style="width: 100%; background-color: #dcdcdc; height: 99px;"; colspan="3">
</td>
</tr>
</table>
I dont want to print out anything but this part:
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
Which on my content page is this:
<asp:content id="Content1" contentplaceholderid="Cont entPlaceHo lder1" runat="server">
<asp:Panel ID="JustPrintThis" runat="server" Height="50px" Width="125px">
<table>
<tr>
<td>
test
</td>
</tr>
</table>
</asp:Panel>
</asp:content>
<table style="width: 98%" border="0" cellpadding="2" cellspacing="0">
<tr>
<td style="width: 100%; height: 29; background-image: url(images/row.gif); font-weight: bold;" colspan="2">
Admin
</td>
</tr>
<tr>
<td style="width: 70%; background-color: #dcdcdc; height: 23px; text-align: left; color: #000000; font-family: 'Times New Roman';">
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Default.asp
position: relative">Home</asp:HyperL
<asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/Schedule.as
<asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/Class.aspx"
<asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="~/Reports.asp
</td>
<td style="width: 30%; background-color: #dcdcdc; height: 23px; text-align: right; color: #000000; font-family: 'Times New Roman';">
</td>
</tr>
<tr style="font-size: 12pt">
<td align="left" colspan="2" style="width: 90%; background-color: #dcdcdc; font-size: 12px; font-family: Arial; height: 18px; color: Black">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td align="left" style="width: 100%; background-color: #dcdcdc; height: 99px;"; colspan="3">
</td>
</tr>
</table>
I dont want to print out anything but this part:
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
Which on my content page is this:
<asp:content id="Content1" contentplaceholderid="Cont
<asp:Panel ID="JustPrintThis" runat="server" Height="50px" Width="125px">
<table>
<tr>
<td>
test
</td>
</tr>
</table>
</asp:Panel>
</asp:content>
ASKER
Got it. Just used the article and gave my <tr> tags in the master pages that I didnt want to show up ID's. Just like the article. Thanks.
ASKER
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Sheet.aspx.vb"
<asp:content id="Content1" contentplaceholderid="Cont
<link rel="stylesheet" type="text/css" href="css/print.css" media="print" />
</asp:content>