.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Change Page orientation before printing

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :WPF

Hi Experts,

I want to implement print functionality, using the below code. How can include the PageSetup dialog box so that I can change the page orientation during run time?

PrintDialog myPrintDialog = new PrintDialog();

myPrintDialog.PageRangeSelection = PageRangeSelection.AllPages;

myPrintDialog.UserPageRangeEnabled = true;

Nullable<Boolean> print = myPrintDialog.ShowDialog();

if (print == true)


myPrintDialog.PrintVisual(MyChartGrid, StringTable.Chart);


View Complete Post

More Related Resource Links

Selected to change the background color of the page



As this site, http://www.borfin.com.tr/genel/Default.aspx, How can I change the background color selected pages.

How to change the default page base class?


I've tried setting the <pages pageBaseType="DynamicWebPage" /> value in web.config, but when I response.write out the page type, I'm still getting Microsoft.WebPages.WebPage.

I'm simply trying to sub-class WebPage and add some additional functionality such as a dynamic PageData dictionary similar to Phil Haack's dynamic ViewData dictionary.



Link goes to next page but url doesn't change?


I have a text input to get a 'roomID' and an ASP button that calls an 'enterRoom' function:

roomID:<asp:TextBox runat="server" ID="roomID"></asp:TextBox>
                <asp:Button ID="Button1" runat="server" Text="Enter Room!" OnClick="enterRoom" />

In my head tags I have my enterRoom Sub:
    <script runat="server">
        Sub enterRoom(ByVal sender As Object, ByVal e As System.EventArgs)
            Server.Transfer("users/room.aspx?roomID=" & Request.Form("roomID"))
        End Sub

Now when I click that button it essentially goes to the right page in all ways but the URL stays as my default.aspx instead of changing to users/room.aspx?roomID=23423. I've tried it in IE and Firefox with the same results. Is this something I'm not understanding about Server.Transfer or why is this happening and how do I fix it?

Change part of a page without full postback


I have a page with two columns. Initially, the left column will contain a list of links that are article titles. Clicking on one of the links will display the text of the article in the right column, keeping the list of titles in the left column. Clicking on another title will clear the text of the first article and display the second. Is there a way to accomplish this without having to repaint the whole page? I would rather not have the whole page resent each time a title is clicked, but rather have the page stay as is and only the contents of the right column get cleared and redisplayed. I assume there's a way to do this with JavaScript, but I don't know how and would appreciate some help. Thanks!

Gridview Sorting and Page Orientation


Hi there,

I have looked at several posts on Gridview sorting but can't seem to get it to work in my code. I am using Subsonic objects as the DataSource. Every time I click on a page or sorting link it does a postback but the page orientation is left at the top, not where the gridview is on the page. Is there a way around this?

This is the code I have written for it:

        protected void PublicNoticeGridview_Sorting(Object sender, GridViewSortEventArgs e)
            MidvaleSiteDBDB db = new MidvaleSiteDBDB();
            SqlQuery pubNoticeQuery = db.Select.From<publicnotice>();

change page language


Hi all, 

I am new to this forum and want to know how can i change the page language.

For example English -> Hindi..

Do any one have any Idea ?


Change label text on master page from the content page.

Hello. Can I access the objects (for example change the label text) on the master page, from its contents page code? If yes, how can I approach that? Thank you Artashes

Dynamically change the page footer height

Hi, I want to dynamically change the page footer height based on a condition? Is that possible?   Thanks in Advance  

change contents of page based on choices

Hi,I am using AppCode and have 6 arrays of information I want to display on my web page. However I only want three to be visible at any one time. ________________________________ |                    |                       |                 | |                    |                       |                 | ________________________________      button             button            button i.e. a table like the above.   I have created the layout and the choice buttons etc I am using querystrings to pass the changes to the webpage.The problem comes however when trying to write the code for the table diplay. Now each has a slightly different layout.My initial thought was to write

what should i add, or change to maintain the addition on the page at button click, yes i know why, b

 - select day using the drop down list  - select the start date using calender (causes an event), a table is made having the dates of the day selected from the start date and shown to the user.  - the table also contains checkbox for each row in a cell  - the user selects the check boxes he wants  - and clicks the button  - the button calls the method in the .cs file which SHOULD TRAVERSE THE TABLE ROWS TO FIND THE ticked checked boxes and the rest is self explanatory the problem ----------- on calender selection change event nothing is lost, but on button click event all things in table created by code is lost. (as the debugger shows that the row count is zero). i understand that in the page cycle the rows etc added the form by the date change event of the calender are not preserved. fine. but whats the solution. please help i have been searching for a solution desperately. the source --------      <asp:Calendar ID="Calendar1" runat="server"          >         <SelectedDayStyle BorderStyle="Dotted" BorderWidth="4px" />         <TodayDayStyle BorderStyle="Solid" BorderWidth="4px" HorizontalAlign="Center"              

Printing a page with all the formatting

Hi, I'm looking for an option to print a web page along with all the formatting of the page, like background color, images etc.. The regular javascript window.print() does print only the text in the page and the formatting is missing. Kindly suggest me a solution for this problem - either in javascript or C#. Any pointers regarding this would be very useful. Thanks in advance!!! --Vijay

CSS Page Ignored When Printing

This is the first time I have tried using a css page for printing and so far, I am having no success. It appears that the css page is being completely ignored.I am trying to print an asp.net control (datalist or panel - I have tried both). I can get the control to print just fine, but with no css formatting. If I use inline css in the control, it works, but I would rather use a style sheet for this.Any help here would be greatly appreciated.I have two style sheets:<link href="../styles/Styles.css" rel="stylesheet" type="text/css" media="screen" />    <link href="../styles/Print.css" rel="stylesheet" type="text/css" media="print" />I have a master page, a content page and a print page. The control is in the content page and is then printed from the print page:masterpage.mastercontentpage.aspxprint.aspxI have tried attaching the stylesheets in all of the pages (master, content and print) but still the print page ignores the css.What am I doing wrong here?Thanks in advance

change search results page According to custom setting page

I want to create user settings page will be able to choose which will  search results display page x or page y Settings will be saved somewhere. When the user searches on sharepoint search page will display to the user  the page that he select in the search page settings page x or  page y   my questions : 1. Is it necessary to treat the user profile - If so how? 2. how results can be directed to the search results page after a user choose Specific page? 3. where save the settings from custom settings page  ?

change the PHP page with WCF service on Servers only, without chnging code on the calling client sid



I need to change the PHP page with WCF service, but the problem is that many of our clients are sending(usig POST) large stream data like binary files to our PHP website, now we are upgrading our system and moving towards wcf services,

The problem is that we want our clients to only change URL, and do not need to change any code in their calling mechanism or no need to create proxy on their cliend side. We simply change php to wcf services on our Servers only. Our clients are using .net 2.0 client application. Is there any way to do this. or Is this possible ?

One thing which I get from internet is use Rest based wcf services.

Have anybody some example or idea to accomplish my task.


Page title with Register symbol change in Master page on postback


I have a below Page title in my master page

<title>My Test Application Name&reg;</title>

It renders Fine with Register symbol after the text "My Test Application Name" on start of the page but on any postback the title turn into My Test Application Name&reg;

Kindly let me know what can i do with minimal effort to fix this issue

Printing of Web Page is smaller with .NET pages



I have been converting classic ASP web pages to the .NET platform and have found that the pages print out MUCH smaller with the .NET version.  Can this be a print property?  IIS setting?  As you can see I'm grasping here so could use a bit of educating about this as well.  This "shrinking" seems to happen in browsers other than IE as well (Chrome and Firefox).

ANY help or directions to helpful articles would be greatly appreciated!



Jeff Tolman

EandM Electric

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend