Print an HTML Page…

<style type="text/css">

 /*  This will hide the page header and footer */



     size: auto;

     margin: 0;



/*  This will hide the Button cmdPrint */

@media print {

  #cmdPrint {

    display: none;






<html xmlns="" >

<head runat="server">






    <form id="form1" runat="server">


        <asp:Button ID="cmdPrint" runat="server" Height="43px" Text="Button"  Width="137px" OnClientClick="javascript:window.print();return false;" />











Center a DIV..



     margin: 0 auto;

     width: 100px;



<div    style="padding-left:50px; border: 5px solid gray; width:1345px " class="center-div">







           <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">

           <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">

           <meta content="JavaScript" name="vs_defaultClientScript">

           <meta content="" name="vs_targetSchema">

           <link href="Styles.css" type="text/css" rel="stylesheet">



  <asp:textbox id=txtLev2 runat="server" cssClass="txtLev"></asp:textbox></TD>



In the Styles.css…



     Width: 50px;

     Height: 20px;









Download a file…

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click


        Dim strOutput As String = "Hello World!"


        Response.Buffer = True

        Response.AppendHeader("Content-Disposition", "attachment; filename=TestFile" & Now().ToShortDateString & ".xls")

        Response.ContentType = "application/"

        Response.Charset = ""

        Me.EnableViewState = False






    End Sub




How to scroll any object…


<div style="OVERFLOW-Y:scroll; WIDTH:585px; HEIGHT:335px">

          Place a table, datagrid or anything else you can think of here







Column Span Sample


<table width="75%" border="1">


    <td colspan="3">This Column comprises all 3 columns of the table!</td>