.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

Printing to printer. Not the page but some specific text.

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net


I do run System.net.Mail on my web pages to send email confirmations. For those who doesn´t have an email I would like to print the letter to a printer.

Below is my code to send a body to the email. It works great. How ever. Could I somehow add a function to my page so when customer has no email the page instead prints the code to our network printer?

Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("    <center> <img src=cid:companylogo> </center><br><br> " & fornamn & " " & efternamn & " " & "<br><br> " & adressen & "<br><br> " & "" & postnummer & " " & "" & postorten & "<br><br><p><strong>Välkommen som medlem i XXXX! </strong></p><p><strong>Tack för din beställning!", System.Text.Encoding.UTF8, "text/html")

View Complete Post

More Related Resource Links

reference from menubuttons to text parts in article on the same page


Hi, I'm searching now for hours but couldn't find it.Cry

In my menu i have several buttons which (by a <a href..) should go the a part of an article that is in the same form.

Menu button : What is a database should go to the page default.aspx and in there is an article published.
A part of this article is having a piece of text about "what is a database"

Menu button: how to make a query should go to this same article in the same page but then to the part that is have the piece about the query. The next could be an example of what i'm doing:

    <li><a href="default.aspx ?????>what is a database</a></li>
    <li><a href="default.aspx ?????>what is a query</a></li>

Where my question marks are, there should be a connection to that particular piece of text.
In each article part there is an ID="text1" and the second part id="text2"

How shoudl i do that, Should i use a question mark.
Please give me some guidance how to structure the <li> statement or a pointer where I can read about it.


allow client to modify text on web page


I have been trying to find out how I can allow a user to modify/update a page/pages on a web site. I understand there has to be site security with authentication and authorisation but what is there as a user interface for them easily to update a page? 

Thanks for any pointers.

Printer Friendly Page from a listview control


Hi guys,

I am working on a web form that displays the data from an access data source into a list view control. I need an advice on how to create , render a new page printer freindly .not buttons, controls,,, I have implemented a  java script function to select which records I want to view in the printable page but I cannot came up with any idea on how  to use this to create the printable help..


Why does text and page formating changes randomly?

Hallo there, First of all I don't know if I am posting in the right forum, so let me know if there is another forum for this issue. My form text and entire page formating changes once a while and I don't know why. e.g. font color, background color of certain paragraphs or table look changes, it seems randomly, I think it has something to do with the style but I don't know how to avoid this repeated text formating loses. In details: U am using Visual Studio 2010 Professional and is set for Visual Web Development. I create a new form e.g. default.aspx link it to a master page and the master page is linked to a css file (style sheet file) that contains only general and basic formatings and I hardly change any thing in this css file. I format my default.aspx. and later the formating chanegs by it self and I have to change it back manualy. Most of the time I have to create a new form. link it to the master page and copy the text, tables and so on from the original page to the new page and then delete the original page. but even the new page chnages later. and so on. I don't know how to avoid that! Any idea's? Thanks in advance  Michael Najar wishes you great day

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

How to return back to a specific page in a gridview list?

Hello,  I have a gridview with paging. So for instance, I'm on say the page number 10, and I open the form details on a specific record_id (link). After I update/submit the form, it returns to page number 10. But, if I go to another page, for instance page 5, and submit the form, it returns to page 10. I've tried some things, for instance history.back(), but it returns to the first page I went to, in this case page number 10 (or whatever the first page I go to). Hopefully this code helps to understand what I'm asking: <asp:GridView DataKeyNames="Referral ID" ID="gvList" runat="server" CellPadding="4"     ForeColor="#333333" GridLines="None" OnRowCommand="gvList_RowCommand"     OnRowDataBound="gvList_RowDataBound" OnRowDeleted="gvList_RowDeleted"     OnRowDeleting="gvList_RowDeleting" AllowPaging="True" PageSize="20"     AutoGenerateColumns="False" OnPageIndexChanging="gvList_PageIndexChanging"    OnRowCreated="OnRowCreated" AllowSorting="True" OnSorting="OnSort"> protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)        {   &nb

Most efficient way to check whether a DataGridView contains some specific text at a specific column

Dear All,   I am looking at the most efficient way to check whether a specific column of a DataGridView contains some text. For example I have a list of firs names and I would like to check whether the text "Bob" already exists in that columns. I would like to avoid to loop through each row but what thinking of using something with "Contains".   Anybody has an idea ?   Cheers,   Kalos

Consistently running out of page file memory with full text indexer

Using MS SQL Server 2008 SP1 x64 Standard Edtion on Windows 2008 R2 Enterprise, I'm about to full-text index for the first time 1 table and 2 views. The table contains about 250'000 entries with a data space of 180 MB. As soon as I activate the full text indexing, the fdhost.exe task starts to consume slowly but surely all the available page file space (this can be easily watched using the Resource Monitor and the Commit Charge graph on the memory tab). Once all the virtual memory has been consumed, the server becomes unusable since it can't open any new windows any more, and RDP stops working. The machine specs are as follows: 12 GB of RAM 80 GB free on hard disk out of 136 GB 8 CPUs Custom size paging file with sizes between 24 GB - 60 GB (originally, this was system managed size, but then the server ran out of memory sooner) Max SQL server memory set to 6 GB (first 10 GB, then 8 GB) I've set the max fulltext crawl range to 8. During the indexing, the 8 CPUs are bit busy for a while, but not excessively. What is astonishing is that there is almost no use of physical memory during the indexing (I can see an increase from 2 GB to 3 GB which still leaves plenty of RAM available). Does anybody have an idea how I can convince fdhost.exe to consume physical memory and leave the paging memory alone? Or what else can I try?

Read a text file on another server from a web page

How do I read/write a text file on another server from a web page. I get the error "Access to the path '//Server2/mydatafiles/test.txt' is denied". I do not get the error if I am running the browser on the server where the files exist. I think I need to set permissions on the destination server in some way.   Can you help? Thanks  

Create buttons for "new item" which create a new page of a specific content type

We have a Pages library (wiki) which supports a few content types (and page layout associated). We want to enable users to click a button for example of "new custom enterprise wiki page" - so a new page of content type article will be open in edit mode. Can someone help how to develop? (it has to mimic the behavior that happens when user creates new page from the Ribbon or Site actions and has to choose the content type, it also has to keep the new page in edit mode and not just create it).  

Problem passing a text box value from aspx.cs page to SelectParameters in aspx page

Hi,I would like to take a value from a text box and pass it as a search parameter to my database. I get the value from my code behind page as follows: protected void btn_click(Object sender, ImageClickEventArgs e)      {           AccessDataSource1.SelectParameters["inputValue"].DefaultValue = TextBox1.Text;           string test = AccessDataSource1.SelectParameters["inputValue"].DefaultValue;                      //string inputValue = TextBox1.Text;          //Response.Write(inputValue);         // AccessDataSource1.SelectParameters.Add("@name", inputValue);          //Response.Write(@inputValue);                              } protected void btn_click(Object sender, ImageClickEventArgs e)     {          AccessDataSource1.SelectParameters["inputValue"].DefaultValue = TextBox1.Text;          //An alternate option I have used is          //string inputValue = TextBox1.Text;         // AccessDataSource1.Selec

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

How To Use a Specific Sites' Master Page for my custom asp.net application

I have a custom application that I migrated to sharepoint (compiling into single DLL and creating a fodler for it in the layouts folder in 12 hive) Currently, I am using ~/_layouts/application.master as my masterpage for the custom application. However, i would like to use a certain site's master page for my application versus the default one. For instance, I would like to use the master page from this sub site www.maindomain/sites/subsite/ Thanks for your help.

anchor text box to specific location in report?

In my report, I've got a map of the world as the background image. In it, I want some textboxes set over certain countries displaying some metrics for them. is there any way to 'anchor' the text boxes  to an exact location on the map? The issue that I'm having is that when the display size changes, then the text boxes move around. Any ideas? 

Redirect to specific page based on user Roles

I am using Formsauthentication. My situation is as per below:the login form has codebehind :==============================protected void LoginButton_Click(object sender, EventArgs e)        {            TextBox uname = Login1.FindControl("UserName") as TextBox;            TextBox pass = Login1.FindControl("Password") as TextBox;            CheckBox rm = Login1.FindControl("RememberMe") as CheckBox;            Literal fail = Login1.FindControl("Literal1") as Literal;            if (Membership.ValidateUser(uname.Text, pass.Text))            {                /                FormsAuthentication.SetAuthCookie(uname.Text, rm.Checked);                            }        &
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