如何获得本页面的HTML的代码
我需要获得本页面的HTML的代码,页面里面有BUTTON   TEXTBOX,和DATAGRID 
 要实现打印本页面的DATAGRID功能,也就是打印页面的部分内容.谢谢
------解决方案--------------------你百度一下datagrid打印
------解决方案--------------------  public static void ToExcel(System.Web.UI.Control ctl,string FileName) 
 { 
 HttpContext.Current.Response.Charset = "UTF-8 "; 
 HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.Default; 
 HttpContext.Current.Response.ContentType = "application/ms-excel "; 
 HttpContext.Current.Response.AppendHeader( "Content-Disposition ", "attachment;filename= "+ " "+FileName+ ".xls "); 
 ctl.Page.EnableViewState =false; 
 System.IO.StringWriter tw = new System.IO.StringWriter(); 
 System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw); 
 ctl.RenderControl(hw); 
 HttpContext.Current.Response.Write(tw.ToString()); 
 HttpContext.Current.Response.End(); 
 }
------解决方案--------------------把GirdView放在一个div中,然后调用IE的打印功能打印这个层的innerHtml
------解决方案--------------------把要打印的东西放到一个div当中 
  <script language= "javascript ">  
 function PageWirte() 
 { 
 var newWin = window.open( 'printer ', ' ', ' '); 
 var titleHTML = document.getElementById( "PageWriteDIV ").innerHTML; 
 newWin.document.write(titleHTML); 
 newWin.document.location.reload(); 
 newWin.print();   
 newWin.close(); 
 } 
  </script>
------解决方案--------------------哈哈, mark .
------解决方案--------------------// 打印示例 
 // 假如需要请改用 DataGrid 原理是一样的 
 // 注意,为了保留打印效果,需要将引用到的 CSS ,无法是 style 还是 link 方式都要输出到弹出的打开页面   
  <%@ Page Language= "C# " %>    
  <!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Transitional//EN "  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">    
  <html xmlns= "http://www.w3.org/1999/xhtml " >  
  <head>  
      <title> Print GridView Test </title>  
      <script type= "text/javascript ">  
     function PrintGridView() 
     { 
         var newWin = window.open( 'about:blank ', ' ', ' ');           
         var html = document.getElementById( "divPrintContent ").innerHTML; 
         html =  " <html>  <head>  <title> 打印页面 </title>  </head>  <body>  " + html +  " </body>  </html>  "; 
         newWin.document.write(html); 
         newWin.document.location.reload(); 
         newWin.print();   
         newWin.close(); 
     } 
      </script>  
  </head>  
  <body>  
      <form id= "form1 " runat= "server ">  
      <div>  
          <input id= "Button1 " type= "button " value= "打印 " onclick= "PrintGridView() " />  
          <div id= "divPrintContent ">  
          <asp:GridView ID= "GridView1 " runat= "server " AutoGenerateColumns= "False " BackColor= "White " 
             BorderColor= "#E7E7FF " BorderStyle= "None " BorderWidth= "1px " CellPadding= "3 " DataKeyNames= "ProductID " 
             DataSourceID= "SqlDataSource1 " GridLines= "Horizontal ">  
              <FooterStyle BackColor= "#B5C7DE " ForeColor= "#4A3C8C " />