<style type="text/css" media="print">
.PrintButton
{
display:none;
}
</style>
.PrintButton
{
display:none;
}
</style>
<asp:Button ID="butPrintTop" runat="server" Text="Print" CssClass="buttonStyle PrintButton" OnClientClick="window.print();" />
Removing the header from the Web Page
To disable this, you can simply change the Header & Footer options in Internet Explorer. While in IE, click on File > Page Setup, and locate the Header & Footer fields. You may see text such as:
"&w&bPage &p of &P" or "&u&b&d"
Removing the header from the web page using code - Think twice before you implement this code
http://geekswithblogs.net/narent/archive/2007/05/14/112479.aspx
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim pageKey As RegistryKey = Registry.CurrentUser.OpenSubKey("software\microsoft\internet explorer\pagesetup", True)
Dim newFooter As String = "&b&D&b&T"
Dim curFooter As Object = pageKey.GetValue("footer")
pageKey.SetValue("footerTemp", curFooter)
pageKey.SetValue("footer", newFooter)
pageKey.Close()
End Sub
Dim pageKey As RegistryKey = Registry.CurrentUser.OpenSubKey("software\microsoft\internet explorer\pagesetup", True)
Dim oriFooter As Object = pageKey.GetValue("footerTemp")
pageKey.SetValue("footer", oriFooter)
pageKey.DeleteValue("footerTemp")
pageKey.Close()
ClientScript.RegisterStartupScript(Me.GetType, "error", "<script language='Javascript'>window.close();</script>")
You can use any of IE's header and footer codes in your custom code as well:
&w Window title
&u Page address (URL)
&d Date in short format specified by Regional Settings in Control Panel
&D Date in long format specified by Regional Settings in Control Panel
&t Time in the format specified by Regional Settings in Control Panel
&T Time in 24-hour format
&p Current page number
&P Total number of pages
&& A single ampersand (&)
&b The text immediately following these characters as centered
&b&b The text immediately following the first "&b" as centered, and the text following the second "&b" as right-justified
No comments:
Post a Comment