Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Affordable ASP.NET Hosting Service
  Ads  
Iron Speed Designer is a software development tool for building database, reporting, and forms applications for .NET without hand-coding.
 


  Sponsors  

Meet Our Sponsors

Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Print edit screen functions
Previous Previous
 
Next Next
New Post 3/16/2007 2:32 PM
User is offline Dylan Barber
651 posts
7th Ranked


Print edit screen functions  

I have a module that has many 'Edit' screens on one of those I need to pull up the info in it in a seperate window and applly a different style sheet for printing - (takes out all the wierd stuff and shows other stuff ) whats really the best way to do this ?

TIA

 
New Post 3/16/2007 6:17 PM
User is offline William Severance
842 posts
www.wesnetdesigns.com
7th Ranked






Re: Print edit screen functions  
Modified By William Severance  on 3/16/2007 8:19:41 PM)

I just went through the same search for a good solution for a custom module I'm almost ready to release.

I have never liked using the DNN print skinobject as it places the print view into a pop-up window.  Most users (self included) run with one or more pop-up blockers turned on.  I was constantly getting user complaints that clicking the DNN print icon in several DNN sites I manage resulted in a page refresh but no print view.  Also, the standard DNN print skin-object does not pass querystring parameters often resulting in a loss of the information filtering the user had set up.

There are a couple of free replacements for the print skin object - DNN Jungle's PagePrint/TemplatePrint Skin comes to mind. It is available at http://dnnjungle.vmasanas.net/Home/tabid/1/Default.aspx and takes care of the querystring problems.

One of the keys to solving the problem is to come up with a css style sheet (contained in module.css) that properly handles the page formatting (as much as possible - page length/breaks is still a real problem) and especially the hiding of controls etc. If you not already familiar with it, look into the use of @Media Print and @Media Screen. Here are a couple of helpful articles on css for printing:

http://meyerweb.com/eric/articles/webrev/200001.html
http://css-discuss.incutio.com/?page=PrintStylesheets

I finally decided to look at how DNN selects the No Skin.ascx skin and No Container.ascx container to create the pop-up print window and modify this basic technique to write a custom printing solution that would display the print view in the current window, properly pass the querystring parameters to my module's print control which would then generate the same data (using nested DataLists) in a print optimized format.  Here's a bit of code that makes use of DNN's (undocumented?) capability of specifying a skin in the SkinSrc parameter and the module's container in the ContainerSrc parameter of the querystring:

Function to return url for module's print hyperlink:

Protected Function PrintURL() As String   
    Return NavigateURL(Me.TabId, "print", GetNavigationParams(True))
End Function

Function to generate querystring parameters including those for print view if Print parameter is true:

Protected Function GetNavigationParams(ByVal Print As Boolean) As String()
   Dim params As New ArrayList
   Dim result As String()
   If RequestID <> -1 Then params.Add("requestid=" & RequestID.ToString)
   If PostID <> -1 Then params.Add("postid=" & PostID.ToString)
   If AuthorID <> -1 Then params.Add("authorid=" & AuthorID.ToString)
   If PageSize <> MyConfiguration.PageSize Then params.Add("pagesize=" & PageSize.ToString)
   If CurrentPage <> 1 Then params.Add("currentpage=" & CurrentPage.ToString)
   If RequestType <> -1 Then params.Add("type=" & RequestType.ToString)
   If Category > 0 Then params.Add("category=" & Category.ToString)
   If DateRange < 1 Then params.Add("daterange=" & DateRange.ToString)
   If Status > 0 Then params.Add("status=" & Status.ToString)
   If OrderBy <> "Order_Date_DESC" Then params.Add("orderby=" & OrderBy)
   If Print Then
         params.Add("mid=" & ModuleId.ToString)
         params.Add("SkinSrc=" & DotNetNuke.Common.Globals.QueryStringEncode((("[G]" & _
Skins.SkinInfo.RootSkin) & "/_default/No Skin"))) params.Add("ContainerSrc=" & DotNetNuke.Common.Globals.QueryStringEncode((("[G]" & _
Skins.SkinInfo.RootContainer) & "/_default/No Container"))) End If result = CType(params.ToArray(GetType(String)), String()) Return result End Function

 This all seems to work well but I feel that the ultimate and much needed solution is for DNN core to eventually provide built-in pdf creation capabilities, particularly html to pdf.  I've also written (for another DNN site) a PDF Generator object that builds upon the open source iTextSharp project to define via xml configuration file(s) a report that is based around a datagrid like section with column data being generated either from a datasource object, sproc name or database SQL command text. One day I'll get around to extending it for other purposes . . .


Bill, WESNet Designs
 
New Post 3/16/2007 11:36 PM
User is offline Dylan Barber
651 posts
7th Ranked


Re: Print edit screen functions  

Bbill - sounds exaxtly like what I need to do and the problems I am having - heres an interesting solution I kind of worked on today after I posted this

Years ago I ran across this on DynamicDrive (http://www.dynamicdrive.com/dynamicindex9/printstyle.htm) and its still there -

Basically it lets you specify a seperate url to print so your  function here to pass url info to it will be useful - now how to add it to the stylesheet etc.?

Be careful with iTextSharp - I had tons of problems getting it to render HTML correctly - if you had better luck please post an example somewhere so I can look at it - when i used it my PDFs loked so crapy i finally ditched it

 
New Post 3/16/2007 11:54 PM
User is offline Dylan Barber
651 posts
7th Ranked


Re: Print edit screen functions  
Modified By Dylan Barber  on 3/17/2007 2:02:50 AM)

well - not sure if this works but i did this bit of code

 Dim myPrint As Literal = New Literal
 myPrint.Text = "<link rel=alternate media=print href="http://www.yahoo.com">"
 Page.FindControl("StylePlaceholder").Controls.Add(myPrint)

 

And it does add the right stuff to the head of the page - so now its just passing the url info so it adds the right skin and css stuff and url info

well it seems this isnt used if i just hit the print button -

 Change StylePlaceHolder to CSS in the above code and it works

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Print edit screen functions
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Get Smarter Mail, SmarterStats, SmarterTickets
Windows mail server, web log analytics, and customer service management software - Free Editions Available!
www.smartertools.com
DotNetNuke Modules, Skins, Training and Consulting
If you want DotNetNuke done right then look no further. Developed Solutions provides module development, skin design, user and developer training and consulting. Based in Adelaide, Australia, we offer our services worldwide.
www.developedsolutions.com.au
Venexus, Inc.
Need custom a custom DotNetNuke module? From module planning to deployment, including training and support, Venexus developers deliver end-to-end web solutions on time and on budget.
www.venexus.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP