Any guidelines that able to print customize a page with custom header and data passing?
I found a solution, but that is print the repeater/gridview without customize the page..
What i need is print a page with customization.
36e1d0310329124ba8fce2070ac095ff

The Red Cross indicates to remove while in print preview.
Auto Landscape if neccessary.
Thanks for in advanced.

protected void Print(object sender, EventArgs e)
        {
            rptView.DataBind();
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            rptView.RenderControl(hw);
            string gridHTML = sw.ToString().Replace("\"", "'")
                .Replace(System.Environment.NewLine, "");
            StringBuilder sb = new StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("window.print();");
            sb.Append("</script>");
            ClientScript.RegisterStartupScript(this.GetType(), "GridPrint", sb.ToString());
            rptView.DataBind();
        }

Recommended Answers

All 4 Replies

Have you tried to further customize the look and feel of the page for printing using CSS Media Types, @media print? You can then provide customized values for properties and/or display: none to those elements you do not want included in the print.

Hmm.. May i know what is that? @.@

The photo of previous post, is the printpreview of the entire page, but i only need capture the information of gridview, repeater, chart, grandtotal if any.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.