I have a page in ASP.NET. In this page, I have a `List<string>` which contains various data. I need to be able to print this information on the client side. So if a logged on user clicks the print button, he is shown a dialog from which to choose settings like which printer, landscape/portrait, number if copies, etc. This is my code:

```
 private List<string> dataToBePrinted = new List<string>();

 public void addDataToList(string text)
 {
    dataToBePrinted.Add(text);
 }

 protected void btnPrint_Click(object sender, EventArgs e)
 {
    //Print contents of dataToBePrinted to local printer here.
 }

```

So far, I have only been able to print the page as-is (with all controls, windows, etc.) but I only need the info in the `List<string>`. How can I accomplish this?

EDIT:

Ok thanks for all the comments/answers guys. I got it working:

```
//When clicking "Print" data, put list in session variables and redirect to new blank page
protected void btnGruppenkalenderDrucken_Click(object sender, EventArgs e)
{
    Session["Printing"] = lstData;
    Response.Redirect("Printing.aspx");
}

//This is the code behind of the new blank page. Cast session variable back to list,   then fill table
public partial class Printing : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        List<List<string>> lst = (List<List<string>>)Session["Printing"];
        foreach (List<string> temp in lst)
        {
            TableRow row = new TableRow();
            foreach (string data in temp)
            {
                TableCell cell = new TableCell();
                cell.Text = data;
                row.Cells.Add(cell);
            }
            tblData.Rows.Add(row);
        }
    }
}
}

//Markup of new page. I added button "btnPrint" that calls javascript for printing when clicked client side.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Printing.aspx.cs" Inherits="WerIstWo.Printing" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Table ID="tblData" runat="server">

        </asp:Table>  
        <asp:Button ID="btnPrint" runat="server" Text="Print" OnClientClick="javascript:window.print();"/>      
    </div>
    </form>
</body>
</html>

```

Now I will just have to format the blank page and all is well.

Thanks again!