I've created a button on my web page in ASP.net using Visual Basic.Net and I want to use the button to print the page, I think I need to use Javascript, but I'm not that familiar with it other than the little bit of it that I found on the Web. I keep getting an error when I use the following code:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="PrintTest.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script type="text/javascript">
function printpage()
{
window.print()
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server" language=javascript onclick="return Form1_onclick()">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 72px; POSITION: absolute; TOP: 112px" runat="server"
Text="Print" Width="104px" Height="40px" OnClick="printpage()"></asp:Button>
</form>
</body>
</HTML>
Could someone tell me what I am doing wrong?
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="PrintTest.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script type="text/javascript">
function printpage()
{
window.print()
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server" language=javascript onclick="return Form1_onclick()">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 72px; POSITION: absolute; TOP: 112px" runat="server"
Text="Print" Width="104px" Height="40px" OnClick="printpage()"></asp:Button>
</form>
</body>
</HTML>
Could someone tell me what I am doing wrong?