473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.f rames[1].focus()
window.parent.f rames[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 1707
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.nosp amwrote in message
news:uT******** ******@TK2MSFTN GP03.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
15956
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 end user ... but when they go to print ... of course they only get a portion of the entire web site. I've searched and found references to CSS...
1
2287
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 going to explain what I would like to do. Clicking on the print button I would like to show immediately the print dialog without open a new window...
0
3745
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 problem is that the page is directly printed and i am not getting the option of print preview. How will it possible?Please give me suggestion My...
3
1865
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 very proficient in HTML, let alone Perl making HTML, so I tried to grab some code I found online and found two issues: 1) In the following code: ...
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.