Link to home
Start Free TrialLog in
Avatar of bertino12
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.master" smartnavigation="True"%>

<asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="server">

<table>just print this table</table>

</asp:content>
ASKER CERTIFIED SOLUTION
Avatar of samtran0331
samtran0331
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bertino12
bertino12

ASKER

I cant link the stylesheet on the page. It gives me an error.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Sheet.aspx.vb" Inherits="Project1.Sheet" masterpagefile="~/Site.master" smartnavigation="True"%>

<asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="server">

<link rel="stylesheet" type="text/css" href="css/print.css" media="print" />

</asp:content>
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
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.aspx" Style="left: 0px;
                            position: relative">Home</asp:HyperLink> -
                        <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/Schedule.aspx" Style="position: relative">Schedule</asp:HyperLink> -
                        <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="~/Class.aspx" Style="position: relative">Classes</asp:HyperLink> -
                        <asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="~/Reports.aspx" Style="position: relative">Reports</asp:HyperLink>
                    </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="ContentPlaceHolder1" runat="server">

    <asp:Panel ID="JustPrintThis" runat="server" Height="50px" Width="125px">
            <table>
            <tr>
                <td>
                    test
                </td>
            </tr>
        </table>
    </asp:Panel>

</asp:content>
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.