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

Hotwired Printer Friendly Page

Ok, so I wanted to make a printerfriendly page for our site. However,
we don't know exactly which pages all need to have the printerfriendly
option or not. So, instead of making custom printerfriendly pages over
and over again, I wanted to do some sneaky stuff in my Print.aspx page
that would instantiate the page that we wanted to print, let the Pages
LifeCycle complete, then grab a particular group of Controls and put
them into the Print.aspx pages control collection. The problem is that
when I Dynamically instantiate the page object using
Activator.CreateInstance, the page that I create has an empty control
collection (count is 0). I cannot figure out how to tell the site that
the page that I instantiated needs to have it's code called.

My other option is to modify the MasterPage and BasePages that we have
to know enough to remove all of the MasterPage and/or BasePage common
content (IE navigation links, etc). I don't know which option is
better, but I do know that this code could not really be shared in the
MasterPage and BasePage, thus doubling the work/maintanence.

Here is what I have thus far:

public partial class Print
{
Page _myPage = null;
protected void Page_Load(object sender, EventArgs e)
{
//string className = Request.QueryString["className"];
//Hard Code for debugging
string className =
"Namespace.Namespace.Namespace.Folder.PageClassNam e";
_myPage = InstiantiatePage(className);
this.Page = _myPage;

//_myPage.Controls.Count equals 0 here

}
private Page InstiantiatePage(string className)
{
Page ret = null;
object[] arr = {};
ret =
(Page)Activator.CreateInstance(System.Type.GetType (className), arr);
return ret;
}
}
Thanks in advance!

Dec 6 '06 #1
1 1069
If anyone else is looking into doing something similar, it is actually
possible with a javascript popup that calls
document.write(window.opener.getElementByID("conte ntDiv").innerHTML);

or something similar, I haven't actually done it yet, but I am sure
that it will work...

AB

Dec 13 '06 #2

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

Similar topics

4
by: ST | last post by:
Hi, I'm implementing a printer friendly feature for all the pages on a web site. I'm separating the header, content, and footer into separate ascx files, which are contained in the main file. ...
2
by: Sandy | last post by:
Hello - I tried to google this, but got back every page on the whole entire web that has printer friendly versions . . . I have a panel containing text from a repeater that also contains text...
2
by: ST | last post by:
Hi, I'm implementing a printer friendly feature for all the pages on a web site. I'm separating the header, content, and footer into separate ascx files, which are contained in the main file. ...
5
by: weetat.yeo | last post by:
Hi all , I have php page which the data in the page are extracted from MYSQL database. The data are retrieved when user click submit button . In the php page , there is a print button for user...
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...
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...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.