Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Hotwired Printer Friendly Page

Reply
Thread Tools

Hotwired Printer Friendly Page

 
 
Beavis
Guest
Posts: n/a
 
      12-06-2006
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!

 
Reply With Quote
 
 
 
 
Beavis
Guest
Posts: n/a
 
      12-13-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make a Printer friendly page in ASP.Net Yog ASP .Net 0 03-27-2006 02:25 PM
Printer Friendly Page =?Utf-8?B?SmltIEg=?= ASP .Net 3 07-01-2005 12:59 PM
Please help - how to create a Printer Friendly web page... =?Utf-8?B?VGlnZ2Vy?= ASP .Net 2 11-10-2004 01:15 PM
Help please: Creating a printer friendly page from a form tommy Javascript 2 10-10-2003 08:04 PM
implementing a Printer Friendly .aspx Page John Klucker ASP .Net 1 08-15-2003 10:54 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57