CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 2/13/2008 2:19:04 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 6 Views: 52 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
7 Items, 1 Pages 1 |< << Go >> >|
wiske80
Asp.Net User
printer friendly page using a querystring in masterpage and pagelayouts2/13/2008 2:19:04 PM

0/0

hi all,

 i'm new to .NET(C#), so i need  some advice on making a printer friendly page. let me explain my situation.

 
I have a couple of pagelayouts(aspx)  which are based on a masterpage which has a layout.css style sheet(<link href="/_layouts/layout.css" rel="stylesheet" />). Now on all the pagelayout i have a little imagebutton(print) when pressed will open another page which is a printer friendly one.

Now i have a print.css which hides all the unnecesarry stuff of the page. This print.css will be in the masterpage too, so all pagelayout automatically use this.

 What i want to achieve is the following. When clicking the imagebutton, the same page needs to open, but only with the print.css activated.

I heard that its possible to when clicking the imagebutton to sent a querystring in the url forexample marketsector.aspx?print=true. Now in the masterpage i need to built some kind of control to read this querystring and if print=true to  use the print.css and if not to use the normal layout.css .

 So i have the idea of how this all will need to work, but not so much how to implement it all... i need to knwo the following:

-  When pressing the imagebutton how can i automaticcaly add "?print=true" to my url?

- And how do i retrieve this querystring from the masterpage?

- and now some kinda if else loop in de materpage to choose from the 2 styles?

 

I have 20 pagelayouts all based on this masterpage and all will have a imagebutton for a printerfriendly page using the print.css. So its obvious to built the control in the masterpage rather then in all the pagelayouts right?

any help and or links to similar topics are welcome !

 

 


 


 

wiske80
Asp.Net User
Re: printer friendly page using a querystring in masterpage and pagelayouts2/13/2008 8:23:24 PM

0/0

 i already figured out how to sent the ?print=true query string from the imagebutton... can someone help me to built to control to switch between the normal and print css sheets...

 all help/suggestions are really welcome...
 

DarthSwian
Asp.Net User
Re: printer friendly page using a querystring in masterpage and pagelayouts2/13/2008 9:01:43 PM

0/0

 Try this

<link rel="Stylesheet" type="text/css" href="style.css" media="screen" id="stylie" runat="server" />

in code behind:

 Private Sub Login_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If request.querystring("print") = "true" Then
            stylie.Href = "style2.css"
        End If
    End Sub
 

 


"Hokey religions and ancient weapons are no match for a good blaster at your side."
wiske80
Asp.Net User
Re: printer friendly page using a querystring in masterpage and pagelayouts2/14/2008 8:02:18 AM

0/0

 thanks for the suggestion.. that seems logical.. only i use C# and how do i add a code-behind file to an existing masterpage?

 and if i want to open the page with the print.css in a new browser which command can i use?
 

 

 

 

wiske80
Asp.Net User
Re: printer friendly page using a querystring in masterpage and pagelayouts2/14/2008 10:21:26 AM

0/0

I did the following i made a control in a seperate printcontrol.cs file. I registered it on the masterpage directives with a tagprefix pc.
printcontrol.cs 
1        public class PrintControl :Page
2 {
3 protected override void OnLoad(EventArgs e)
4 {
5 //base.OnLoad(e);
6 if (Request.QueryString["Print"] == "true")
7 {
8 this.Response.Write("< link href=\"/_layouts/print.css\" rel=\"stylesheet\" />");
9 }
10 else
11 {
12 this.Response.Write("< link href=\"/_layouts/grontmij.css\" rel=\"stylesheet\" />");
13 }
14 }
15 }

  now when i added the following line to the masterpage where i initially added the original css..

 

<pc:PrintControl id="printcontrol1"  ></pc:PrintControl>
 
but when i try it nothing happens, in fact it doesnt render a thing, so now not even 1 one the styles is loaded... and if i add a runat=server to the printcontrol tag is crashes...
Is something wrong here guys... please help me out... and forgive my coding skills... i'm a newbie... 
  
Amanda Wang - M
Asp.Net User
Re: printer friendly page using a querystring in masterpage and pagelayouts2/17/2008 9:46:11 AM

0/0

Hi,

wiske80:
can someone help me to built to control to switch between the normal and print css sheets...

If you want to switch between the normal and print css sheets, you can try to like below:

 protected void Page_Load(object sender, EventArgs e)
    {
 
       HtmlLink links = new HtmlLink();
        links.Attributes.Add("rel", "stylesheet");
        if (Request.QueryString["Print"] == "true")
        {
            link.Href = "/_layouts/print.css";
        }
        else
        {
            links.Href = "/_layouts/grontmij.css";
        }
        this.Page.Header.Controls.Add(links);
    }

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
wiske80
Asp.Net User
Re: printer friendly page using a querystring in masterpage and pagelayouts2/18/2008 12:06:25 PM

0/0

 thanks.. that worked fine... thanks alot for the help

 

7 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007

Web:
master pages querystring parameter like ?pf=1 to invoke the printer friendly master ... decorated with that print friendly master page. Do you think this a workable solution? here is blog article describing dynamic page layout through MasterPage : ... bits using display:none; and so do away with the additional ...
How We Did It: Australia National Native Title Tribunal website ... Jul 7, 2008 ... Other Master Pages were developed to provide “print friendly” views of the page and a text-mode version. These Master Pages are switched on the fly using a custom base ... Adding Code-Behind Files to Master Pages and Page Layouts in .... the appropriate parameter in the search page query string. ...
Get SharePoint Designer training on your desktop - SharePoint ... Oct 27, 2008 ... The training, using easy to understand videos, will lead you step-by-step ... Learn how to use SharePoint Designer to set the master page for the site and how to ... Learn how to use SharePoint Designer to customize a pre-existing Publishing Page Layout. ... advertisement. Printer-Friendly Version ...
Beginning ASP.NET 2.0 printer friendly version. Steve Joubert. Beginning ASP.NET 2.0 ... Set up your logo, navigation bar and footer just as you did before using HTML and ASP. ... Page so Master Page objects are inherited from System.Web.UI.MasterPage. ..... it's possible to create neater URLS, free of bulky Query String parameters? ...
Get SharePoint Designer training on your desktop - SharePoint ... Printer-Friendly Version. Get SharePoint Designer training on your desktop ... Learn how to create a custom list data submission form using SharePoint ... Learn how to create data view properties that can be read in from a query string . ... Learn how to use SharePoint Designer to set the master page for the site ...
CodeProject: MasterPages for .NET 1.1 (again). Free source code ... Everything works the same as if you were not using the master page solution. ... The red lines are caused due to the fact that there is no itellisense for the master page layout structure. ... QueryString("PageID") Is Nothing Then basePage = Request. .... The urls look like this (which are more friendly than DNN): ...
Salut! TNHDang's Space - Windows Live Other Master Pages were developed to provide "print friendly" views of the ... These Master Pages are switched on the fly using a custom base Publishing Layout Page class, which switches the Master Page based on query string parameters. ... Page Layouts are page templates that are associated with a Content Type ...
Information Architecture for Fabrikam Industries Intranet ... If print designers are not experienced in designing for Web interfaces, ... By modifying or creating your own custom master page by using Microsoft® Office ... cascading style sheets, page layouts, and master pages are all contained in lists ..... action URLs can include query string or form header data based on ...
An Xml-Driven, Self-Caching ASCX MenuStrip Control Oct 28, 2006 ... By Peter Bromberg Printer Friendly Version ... 1) The CSS to match my page layout is inline in the ASCX page ... I'm going to include a MasterPage and two Default pages with two .... add a custom querystring item to the particular personalized link ... C# : Database monitoring system using XML file ...
Graphics & Multimedia : The Official Microsoft ASP.NET Site Create real-time image effects on your web page with Flash Image Enhancer ... Web Tab & Web MultiView, Web Splitter and Web Menu provides users with friendly page layout, ... user preferences, and information passed in a query-string parameter. .... Using the Submit Control Wizard you can add controls that you have ...




Search This Site:










set dropdownlist to expand to width of text on selection?

added upload button dynamically

declaring a global variable

some very easy questions

new to visual studio, experienced with classic asp/notepad

connection string help! - trying to create new users on go daddy hosted site

updating visual studio (framework ?)

site description for search engines

restore debug function

.net yahoo's launchcast radio - question

using a custom validator

does the iusr_<machine name> get created during installation?

displaying advertisement in asp.net...

how to log errors

how to get button to resize to text added on fly?

web forms table - adding static text?

hyperlink in untyped dataset

personalisation

can i read an uploaded file without first saving it on the server?

displaying a validation label

file explorer?

calendar

asp.net 1.1 or 2.0?

can i do this??

accessing another site's code (adding reference) in 2.0

forums template

giving asp.net privileges to use the excel library

restricting non numeric values

whidbey beta2 release date?

null values

  Privacy | Contact Us
All Times Are GMT