[Download Code]
The test page conatins a test form with two fields. Only two lines of code in the Submit_Click routine are needed to print the web form. You must change the printer name to one that is installed on your server. For local printers and printers that use IP printing just use the name in your printers folder (example: "HP 1200") For Novell network printing use the path (example: \\server\printer). You may have to add impersonation to your web.config file for Novell network printing. One other note, the submit button must have an id equal to "Submit" or it will also be printed.
Test.aspx:
<%@ Page Language="C#" %>
<%@ outputcache location="None" %>
<script runat="server">
void Submit_Click(object sender, EventArgs e) {
CsXml.FormPrint.WebPrinting wp = new CsXml.FormPrint.WebPrinting();
wp.PageCreate("HP 1200", "TEST FORM");
}
</script>
<html>
<head>
<title>Test Form</title>
</head>
<body>
<form runat="server">
<table>
<tbody>
<tr>
<td colspan="2">
<strong>Test Form</strong></td>
</tr>
<tr>
<td>
First Name</td>
<td>
<asp:TextBox id="FirstName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Last Name</td>
<td>
<asp:TextBox id="LastName" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button id="Submit" onclick="Submit_Click"
runat="server" Text="Submit"></asp:Button>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>