jteixeira Posted April 11, 2007 Share Posted April 11, 2007 hi, I'm using visual web developer in c# and I would like to implement a button which will, upon click, print the currentwebpage.I have no idea where to begin, I think I need some sort of client scriptingbut I suppose there's a simple solution for this... Link to comment Share on other sites More sharing options...
aspnetguy Posted April 11, 2007 Share Posted April 11, 2007 HTML <asp:Button id="btnPrint" runat="server" text="Print"/> C# // in Page_LoadbtnPrint.Attributes.Add("onclick","window.print();"); Link to comment Share on other sites More sharing options...
jteixeira Posted April 11, 2007 Author Share Posted April 11, 2007 one more question, do you know any way to send current webpage for mail? Link to comment Share on other sites More sharing options...
aspnetguy Posted April 11, 2007 Share Posted April 11, 2007 put this in the head of your page <script language="javascript">function mailpage(){mail_str = "mailto:?subject=Check out the " + document.title;mail_str += "&body=I thought you might be interested in the " + document.title;mail_str += ". You can view it at, " + location.href;location.href = mail_str;}</script> Then use the same approach as the print page except replace window.print() with mailpage() Link to comment Share on other sites More sharing options...
jteixeira Posted April 11, 2007 Author Share Posted April 11, 2007 where i put the email adress? Link to comment Share on other sites More sharing options...
aspnetguy Posted April 11, 2007 Share Posted April 11, 2007 this will open your default mail client and a new message where you can type in any address you want. You cannot mail it directly. Link to comment Share on other sites More sharing options...
jesh Posted April 11, 2007 Share Posted April 11, 2007 This link may help. I only read the title () so I can't comment on the contents, but it may help.Emailing the Rendered Output of an ASP.NET Web Control in ASP.NET 2.0http://aspnet.4guysfromrolla.com/articles/122006-1.aspxEDIT: Here's another link:http://www.devhood.com/tutorials/tutorial_...tutorial_id=758 Link to comment Share on other sites More sharing options...
jteixeira Posted April 12, 2007 Author Share Posted April 12, 2007 What i pretend is: i have a web page of invoices and i want when i click in button "send by email", mail all the page for one person automatically.Sorry my English Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now