C# .NET - Printing a asp net web page
Asked By Pragya Jaiswal
20-Mar-05 07:06 PM

I am a novice in asp.net and so please pardon my question if it
seems silly.
Presently I am working on an asp/c#.net project and for that I need
to print a web page, which has a record retrieved by querying from
the sql server database.Each record has about 50 fields. The data is
displayed in the form of a table with 2 columns and 50 rows. Each of
this rows have some text boxes and labels. Because there are so many
rows I want that the table comes in a good format on both pges
rather than breaking abruptly on one page.Basically, it is a "form"
sort of a page.
This is an example of the page I need to print:
http://www5.geog.okstate.edu/NewOli/querydata.aspx?objectid%20=15702
The problem is I dont know how to print the page without the buttons
being shown on the print page, without the bottom "home, logout" etc
and also there is a datagrid in the page which has visibility
as "false" , but still print with 2 empty pages. How can I eliminate
that?Also, I need page breaks at appropriate places on the page.
How can I print only the contents I need ignoring the other contents?
Also, I have another question, is there any way to dynamically
convert the web page to pdf?Or can anyone tell me which would be a quick and easy way of printing the web page, as I need it very urgently.
I would really appreciate any help on this.
How did you get the print to work
Hi, i'm trying to get a print to work from webpage and found your post while doing a search online. I see you finally got yours to work. Would you please tell me how. mY email is dalia2477@yahoo.com your help is appreciated thanks dalia
forum
How to print web page?
Hallo.. can you tell me how to print a page?? like your online demo Please
Riny (riny.muliawan@kabelvision.com)
How to print web page?
Hallo.. can you tell me how to print a page??
like your online demo Please..
Riny (riny.muliawan@kabelvision.com)
Printing only specific part of page
create a css as follows in javascript:
<STYLE type="text/css" media="print">
.hidePrint { visibility:hidden; display:none;}
</STYLE>
then apply that css class to the elements you want to hide.
Print a html page which has a table with empty columns
Hi,
I have a dialog box which has a print button and a table with around 50 columns and 10 rows. Few columns in that table are empty. I am able to print this page but the empty columns doesnt appear as is in the UI. I mean the column size is not same as the header as shown in the UI.
Can anyone guide me as how to resolve this?
Thanks in advance.

How can we know a state of a thread? (A) What is use of Interlocked class ? (A) What is a monitor object? (A) What are wait handles? (A) What is ManualResetEvent and Webservices (B)What is an application domain? (B) What is .NET Remoting? (B) Which class does the remote object has to inherit? (I) what are two different types of remote Cache substitution? Chapter 6: OOPS (B) What is Object Oriented Programming? (B) What is a Class? (B) What is an Object? (A) What is the relation between Classes and Objects? (B Overriding? (I) what is the difference between delegate and events? (B) If we inherit a class do the private variables also get inherited? (B) What is the different accessibility levels defined in .NET? (I) Can you prevent a class from overriding? (I) what is the use of “Must inherit” keyword in VB.NET? (I Do interface have accessibility modifier. (A) What are similarities between Class and structure? (A) What is the difference between Class and structure’s? (B) What does virtual keyword mean? (B) What are shared (VB.NET 9: ADO.NET (B) What is the namespace in which .NET has the data functionality class? (B) Can you give an overview of ADO.NET architecture? (B) What are the two
this their first time in? if( blnEdit ) then blnFirstTime = false else blnFirstTime = true end if '* = * = * = * = * = * = * = * = * = * = * = * = ' 'PRINT THE HTML TO SCREEN' '* = * = * = * = * = * = * = * = * = * = * = * = ' Response.Write "<html> " & vbCrLf Response.Write "<head> " & vbCrLf Response.Write "<meta rel = 'stylesheet' type = 'text / css' href = 'css / AppStyles.css'> " & vbCrLf Response.Write "<title> MWC Order Database - Enter a new order< / title> " & vbCrLf %> <script language = "JavaScript" type = "text / javascript"> <!- - / / omitting JavaScript to addNewOrder' method = 'post' action = 'AddNewOrder.asp?sid = " & lngSalesID & "&c = true'> " & vbCrLf Response.Write " <tr> <td class = 'tdcenter HeadBlack' colspan = '2'> " & strStatus & "< / td> < / tr> " & vbCrLf Response.Write " <tr> <td colspan = '2'> <hr> < / td> < / tr> " & vbCrLf Response.Write " <tr> <td class = 'tdright cssText' colspan = '2'> <b> Date:< / b> <input type = 'text' name = 'curdate' value = '" & Date() & "' maxlength readonly> < / td> < / tr> " & vbCrLf Response.Write " <tr> <td> < / td> < / tr> " & vbCrLf Response.Write " <tr> <td class = 'tdleft requiredField'> Client:< / td> " & vbCrLf if( blnChosen ) then Call InputText( "ClientName", "Client:", strClientName, strClientError, intClientSize, intClient, vbNullString, blnFirstTime, true, true ) else Response.Write " <td class = 'tdleft cssText'> <select name = 'ClientName' id = 'ClientName' onBlur = 'addNewOrder.submit();'> " & vbCrLf for i = 0 to hr> < / td> < / tr> " & vbCrLf ' / / / / / / / / / / / / / / / / / / / / / Order Information / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / if( blnEdit ) then if( Not(blnFirstTime) ) then %> <tr> <td class = "tdleft requiredField"> Start Date:< / td> <td class = "tdleft cssText"> <input type = "text" name = "StartDate" value = "<% = strStartDate%> " size = "<% = intDateSize%> " maxlength = "<% = intDate%> " readonly> <font
sOption+ = "scrollbars = yes, width = 750, height = 650, left = 100, top = 25"; var winprint = window.open(" / print.asp", "Print", sOption); winprint.focus(); } < / script> < / head> <body style = "margin: 0px;"> <form id = "form1" action = "post"> <!- -BeginNoIndex header"> <div id = "menu"> <table border = "0" cellspacing = "0" cellpadding = "0"> <tr> <td align = "center" class = "first"> <div id = "searchbox"> <fieldset> <input name = "ctl00$searchRelatedText" type = "text" id = "ctl00_searchRelatedText" onkeydown = "return searchRelatedMaster(event);" class = "searchRelatedText" / > <a href = "javascript:doSearch();"> <input type = "button" id = "search-submit" value = "" onclick = "doSearch();" / > < / a fieldset> < / div> < / td> <td align = "center" class = "first"> <a href = " / articlelist.aspx"> Articles< / a> < / td> <td align = "center" class = "first"> <a href = " / forumtree.aspx"> Forums< / a> < / td> <td align = "center" class = "first"> <a href = " / faqlist.aspx"> FAQs< / a> < / td> <td align = "center" class = "first"> <a href = " / conversationgroupsummary.aspx"> Groups< / a> < / td> <td align = "center" class = "first"> <a href
of housing developments). In the world of OOP, this blueprint is referred to as a class, while the building is analogous to an object. A term we often hear in relation of an object that I ever heard was, "An object is an instance of a class." Huh? Actually, like almost anything else in life, it's pretty simple once you look really living or breathing in the computer world) built according to plans defined in a class. Furthermore, as in the construction example, a potentially infinite number of similar objects can be instantiated from the same class. This is one of the ways in which code re-use is achieved - we need only write a chunk of code once and then access the class in order to use it again and again. Consider the following code: class MyClass{ / / This is the blueprint public void SomeMethod(){ / / Some code here } } public void MyMethod(){ / / This is the instantiation of the class MyClass mc = new MyClass(); / / This is using the class's code mc.SomeMethod(); } Here we see the instantiation of a class and a call
safety reasons. Rather, C# has introduced a new object called DELEGATE for this purpose. Like Class type, we define Delegate type and then create an instance of delegate to hold the operate on any two numbers and returns an integer. Thus it can be used to print the result of Addition, subtraction, multiplication or any type of procedure which takes two integers start by writing three classes, which will be called Email, Fax and Letters respectively. Each class will have its own methods of sending Information. Therefore, Email class will have SendEmailMessage method, Letter will have SendLetter and Fax will have SendFax methods for sending information. Now, we need another class called MessageWatcher, which is responsible for invoking the appropriate send method based on user's event and calls the appropriate Event Handler. In this case the SendEmailMessage method of Email class. Lets see how this can be done. The MessageWatcher class and the generic SendMessage function is shown below. / / define MessageWatcher class which will send the messages public class MessageWatcher { / / define messenger delegate public delegate void MessageHandler