.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

I need to hide the print button when user clicks print

Posted By:      Posted Date: September 13, 2010    Points: 0   Category :ASP.Net
using vb.net/asp.net 2005.when the user clicks on a linkbutton I am displaying records from my gridview, popping up a new window so that the user can print the records being displayed in the gridview, dvName is the name of the dive that encloses the gridview and gvName is the name of my gridview.The display and print functionality is working fine but the problem is that I am trying to hide the print button from being printed.  When the user clicks on print then all records (good) and the print button (not good) are being printed, here is the javascript that displays the records and the print button.function printDiv(dvName, gvName) { try{ var sOption="toolbar=no,location=no,directories=yes,menubar=no,"; sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; var countRows = 0; var gridview = document.getElementById(gvName); if(gridview != null) { countRows = gridview.rows.length; if (countRows > 0) { countRows = countRows - 1; } } var sWinHTML = document.getElementById(dvName).innerHTML; var winprint=window.open("","",sOption); winprint.document.open(); winprint.document.write('<html><LINK href=MyStyleSheet.

View Complete Post

More Related Resource Links

How to hide 'Print' button in report viewer??


Hi, i want to hide print button in report viewer by using javascript or with some CSS trick.

By default print button is visible. I don't want to hide by using 'ShowPrintButton' property.

Thanks in advnace.


Reporting services in 2008 r2 how to get a report in a print button click event in my c#.net page


how to  get a report in my c#.net page button lick event also steps to call a report from asp.net to reporting services


Thanks in advance

Infopath 2007 print view in browser enabled form with Print button


Hi i create a  print view brower enabled form in Infopath 2007 with header and footer. In Infopath works fine. Margin was ok, header and footter to. But then i try to print this browser the margin, header and footer it changes to default setting of browser ? I try also create a print button in form with VS 2008 code, but method :

this.print(); not working.

It is possible to print the "print view" in browser as the same like in Infopath 2007? Does anyone have the code how to create a print button in C# on browser enabled form?

click a button to print current window form

how can i click a button to print current window form? i don't know how to set and define something? anyone give me example for my reference   thanks.

Access denied when user clicks refresh BDC column button

Access denied occurs with any non Site Collection Administrator regardless of rights.  It only occurs in this site collections, others they are able to refresh.  In this particular collection they can add a BDC column to a list, edit an item and place/resolve a value in the bdc col; but when they refresh they are given an acess denied.  Any thoughts on what they need read access to?  This goes away if I give site admin privs (dont want to do that) or give them read only access on the web application (dont want to do that either).

Does the ReportViewer control print button work inside of a modal MSIE window?

I am getting the following two error messages when using the new ReportViewer v10 control after pressing the toolbar print button. I am only seeing this error inside of a modal popup window in MSIE. The print button in a normal popup window doesn't have this error. An error occurred trying to get the current window Error: Could not complete the operation due to error 8007f305. If anyone knows of a quick fix, please let me know. Thank you. VS2010, MSIE 8, SQL Server 2008.

ReportViewer Print Button not working correctly with windows 7 clients

I need some help being pointed in the right direction to fix the following issue: - After building several reports using reportviewer and testing with windows XP clients everything seemed to be fine.  I noticed that the first time the client loaded the asp.net website and clicked the print button it asked permission to install a small file (I assume this is to allow the reportviewer to access the clients printers).   - The problem I have is on Windows 7 Clients.  They can view/export the reports with no problem, but when they click the print button it ask permission to install the small file, but a error is given during the install process and the file is not installed.   If anyone has a solution or can point me in the right direction it would be helpfull.  I am using Visual Studios 2008 on Windows XP PRO and the site is hosted on Windows Server 2003 R3   Thanks 

Print Button +code in form

Using sharepoint 2010 and designed a simple form. How can I add the Print functionality to the ribbon from standard SP2010 NOT using Infopath? thx

have print friendly page, want to hide columns of gridview

using vb.net/asp.net 2005I have linkbuttons calling the javascript function at the bottom of this post to print out the contents of a div and this is working ok but theissue that i have is inside the div is a gridview that displays links and another text column (among other colums) and I would like tohide the links and the text column next to it using css.Has anyone done this?btw, here is the javascript print function# function printThisDiv() # { # try{ # var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; # sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; # # var sWinHTML = document.getElementById('dvTheDivIWantToPrint').innerHTML; # # # var winprint=window.open("","",sOption); # winprint.document.open(); # winprint.document.write('<html><body>'); # winprint.document.write(sWinHTML); # winprint.document.write('</body></html>'); # winprint.document.close(); # winprint.focus(); # # }catch(err){ # txt="There was an error on this page.\n\n"; # txt+="Error description: " + err.description + "\n\n"; # txt+="Click OK to continue.\n\n"; # alert(txt); # } }

Content cutoff in Print preview screen when a print button is clicked from a WPF application in Dell

Hello, I am facing a problem in printing.. I have a WPf+windows application running on the Dell Mini Net book(10") with screen resolution 1366 x 768. I am trying to the print the page with heading, image & some measurements on a 81/2 x 11. the print preview seem to be ok on the desktop(screen resolution 1440 x 900). but when i run same application in dell mini the layout is cutoff, the text is started from the footer area,  the page is not shown completely.. Can any one help me in this regard??   Thanks for the help in advance Archana

Hide edit button on editform based on whether the user is item's creator


Hi Everyone


I would like to hide/show the edit button on a list item's edit form based on whether the user is the item's creator.  The reason I want to do this is because SharePoint's out-of-the-box behaviour is such that when a user edits someone else's item, the Access Denied page pops up AFTER the user makes his/her edits and presses ok.


My users want the edit button to be hidden so they don't have to go through the steps of making the edits, press ok, and then find out their access is denied.


I have done some research, and the approach I have arrived at is to create my own edit item user control, which has my own cutom code which checks if the user is the creator, and then hide/show the edit button.  I have 2 questions surrounding this:


1) Can anyone provide some advice or resources on the web which describes how to best implement an edit form user control and then integrate it into SharePoint so that the user control is only used on my particular list, and doesn't affect anything else in the site collection.


2) Can anyone suggest another approach perhaps requires less custom development effort than the custom user control approach?

Updating Person/Group Field when Current User Clicks Button


Hi all,

Im trying to either add the current user to a multi person/group field or remove them if they are already in the field when they click a button. My code works to decide which button to render on the page - it will show "Add" if the current user is not in the multi person/group field (titled Members) or it will display "Remove" if the current user already exists in the multi person/group field.

My problem is that when the user clicks the button, i want to take the value in the multi person/group field and use XSL string functions to either add/remove the current user to/from the string and push the updated string back into the multi person/group field - This is not working for me. I can reference the correct column with javascript, but it seems the value i get from the person/group column is not just a simple string, its got all sorts of HTML in there. I was hoping just to get a string like, "member1;member2;...). Ive tried changing the field to just display the account (rather than the name with presence), but it still pulls back a huge chunk of code that i cant work with.

Below is my code so far, just to give you an idea - anyone know what im doing wrong?


Crystal Report Export and Print button not working inside UpdatePanel



Iuse UpdatePanel for my pages, clients requested to view pages without flickering.

So, I put all component in update panel, but after that, export and printing for Crystal Reports stoped to work. If I put report viewer outside of updatepanel its working.

Have anyone this problem? There's some solution for this?

Thanks, Paul

is it possible to make button can print my DataGridView Data ?????

i have a form include datagrid so i wanna print the queried data on it

how i can do that

Print or save several pages without user interaction


Hello! I've run into a huge problem which I can't seem to solve.

I've made an application in C# with a webbrowser that automatically browses several different pages on our internal website. I need my application to be able to either save each page or print each page to a PDF (like with CutePDF, PDFcreator) and set the filename & destination from code. All this without any user interaction - it's kind of a bot to do stuff for us.

I've tried all of the following:

urlDownloadToFile - does not work in this scenario because the URL's that my application goes to are not "real" URL's, as in if you copy & paste the URL to a webbrowser you get re-directed to the home page instead. The pages my application visits are reports generated by setting some values.

EnumWindows & SendMessage - Tried to locate the Save As-dialog and simulate clicks on the Save-button. Spent two days trying to get this to work but I could not. I am a low level programmer who's learning. (= 

iTextSharp - Tried to make iTextSharp generate a PDF from the HTML of webbrowser - I failed on this aswell.

I really need the pages visited printed/saved automatically! If someone can provide guidance & code I would be eternally thankful.

Note: Found other threads kinda si

Hide userControl inside the user controls' button Click



I created simple web usercontrol ABC with Yes/No button.In Current pages submit Button Click it popup's ABC user control. ABC user controls Yes button Click it executes some serverside function.But I want to close/hide this user control after the Yes button Click ( like confirm box in javascript).But its not hiding after setting the visible property to false. Is there any way to implement this...


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