473,382 Members | 1,336 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,382 software developers and data experts.

Can I print a portion of a page?

Hi all,
Again running into problems converting existing ASP to ASP.NET 2 in VB. I am
simply trying to print a portion of the HTML displayed on-screen and not the
entire document. Specifically I just want to print the HTML contained in the
content area of my Masterpage layout, without the user having to click
File/Print in the browser.

I was able to create an Email body from that same content using some
javascript and and the OuterHTML property of the container (which in this
case is a Table with a specific Id). Of course I added the surrounding
<htmland <bodytags before sending the email. Worked just fine.

The ASP program uses frames for printing. One frame allows the user to
select some options which change the printed output in some minor ways. The
2nd frame contains the HTML page content without the Menus, borders, etc.
The first frame also contains a Print button that calls the javascript
code...

<script>
function printIT()
{
window.parent.frames[1].focus()
window.parent.frames[1].print()
}
</script>

Pretty simple stuff really. I've been searching most of the day for a good
article on using frames in .NET and finally found one. The article suggested
placing the frameset in a plain .htm page and then calling the .aspx pages
as the source.

So I create my HTM page and now VS2005 is giving me the error -- Element
"frameset" is not supported. The author clearly states that his method was
used in .NET 2.0. Very frustrating indeed.

Sometimes finding relevant content in MSDN is like locating a needle in a
haystack. It seems like this should be a rather easy task.

So my questions:
1. Can I use frames in such a way as to allow VS to actually accept and
compile the syntax?
2. Does ASP.NET have an easier way to accomplish what I need to do?

Thanks to all for your input.

Apr 24 '07 #1
2 1693
So my questions:
1. Can I use frames in such a way as to allow VS to actually accept and
compile the syntax?
Yes, but you need to specify that you wish to use the HTML 4.01 Frameset
"flavor" of HTML in your DOCTYPE. You can do this by changing the validation
document of the page.
2. Does ASP.NET have an easier way to accomplish what I need to do?
Most sites I've seen that need to provide a printable something or other
simply have the user click a button, which causes a new window to open that
contains the data to be printed. This only requries some client-side
JavaScript and no frames at all.

>
Thanks to all for your input.

Apr 24 '07 #2
Thanks Scott...

Maybe I will just re-create the contents of the Content area in a new window
as you suggest. I just need to come up with a way to allow the user to enter
the printing preferences when he clicks the Print button on the original
page. The user preferences have nothing to do with the actual Printer
settings, but rather what content to include or exclude, depending on the
intended recipient of the printed document. Hmmm... maybe I can have 2
buttons on the Parent page... "Print Options" and "Print". Ok, sounds like
the way to go, as it appears that Microsoft is trying to bury the frames
concept eventually anyway.

Thanks again. A fresh perspective helps after a mind-bending day.

"Scott M." <s-***@nospam.nospamwrote in message
news:uT**************@TK2MSFTNGP03.phx.gbl...
>So my questions:
1. Can I use frames in such a way as to allow VS to actually accept and
compile the syntax?

Yes, but you need to specify that you wish to use the HTML 4.01 Frameset
"flavor" of HTML in your DOCTYPE. You can do this by changing the
validation document of the page.
>2. Does ASP.NET have an easier way to accomplish what I need to do?

Most sites I've seen that need to provide a printable something or other
simply have the user click a button, which causes a new window to open
that contains the data to be printed. This only requries some client-side
JavaScript and no frames at all.

>>
Thanks to all for your input.


Apr 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: BBB | last post by:
I have a web form with a <div> section ... I have it setup so the Update/Cancel buttons are fixed at the bottom of the screen while the content of the form is in the <div> and scrolls. Nice to the...
1
by: BELIUS | last post by:
Hi all, I am implementing a "Print this Page" function in my ASP.NET application. This function should print a part of the page and I would like to use an MSDN Style "Print this Page". I'm...
0
by: agarwalsunitadhn | last post by:
hi.. How will i use print and print preview option. I have to print only a part of a page. for that i declare in a div and give that a id and then using java function to print that portion but my...
3
Ganon11
by: Ganon11 | last post by:
Hey everyone, For a class assignment, I am making a class scheduling CGI program/script. I have everything working so far except actually displaying the schedule as a grid/2D table. I am not...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.