?
Solved

Printing html in asp .net master pages

Posted on 2007-07-31
5
Medium Priority
?
245 Views
Last Modified: 2008-07-03
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>
0
Comment
Question by:bertino12
  • 3
  • 2
5 Comments
 
LVL 37

Accepted Solution

by:
samtran0331 earned 2000 total points
ID: 19599751
You can use CSS and div tags to do this...have a look at this link:
http://www.killersites.com/articles/newsletterArchive/Newsletter_Nov3_2003.htm

0
 

Author Comment

by:bertino12
ID: 19600008
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>
0
 
LVL 37

Expert Comment

by:samtran0331
ID: 19600599
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
0
 

Author Comment

by:bertino12
ID: 19601014
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>
0
 

Author Comment

by:bertino12
ID: 19601246
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.
0

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question