<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!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 runat="server"> <title>Pring in ASP.NET</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="btnPrint" runat="server" Text="Print" OnClick="btnPrint_Click" /><br /> <asp:Panel ID="pnl1" runat="server"> <table width="100%" style="margin:auto; border:1px solid black; border-collapse: collapse; "> <tr style="background-color: #85C1E9;"> <td style="font-size: 11pt; font-weight: bold; text-align:left;">Customer</td> <td style="font-size: 11pt; font-weight: bold; text-align:right;">Status:</td> <td style="font-size: 11pt; text-align:left;"><asp:Label ID="lblStatus" CssClass="text-center" runat="server"></asp:Label></td> </tr> <tr> <td style="text-align:left"><asp:Label ID="lblCustName" runat="server"></asp:Label></td> <td style="text-align:right;">Order Id:</td> <td style="text-align:center;"><asp:Label ID="lblOrderId" runat="server"></asp:Label></td> </tr> <tr> <td style="text-align:left;"><asp:Label ID="lblCustAddr" runat="server"></asp:Label></td> <td style="text-align:right;">Order Date: </td> <td style="text-align:center"><asp:Label ID="lblOrderDt" runat="server"></asp:Label></td> </tr> <tr> <td style="text-align:left; width:70%;"><asp:Label ID="lblCityStateZip" runat="server"></asp:Label></td> <td style="text-align:right; width: 15%;">Sales Person: </td> <td style="text-align:center; width:15%;"><asp:Label ID="lblSalesPerson" runat="server"></asp:Label></td> </tr> </table> <asp:Repeater ID="rptrOd" runat="server"> <HeaderTemplate> <table width="100%" style="margin:auto; border:1px solid black; border-collapse: collapse;"> <tr style="background-color: #85C1E9;"> <td style="font-size: 11pt; font-weight: bold; text-align:left; width:60%;">Description</td> <td style="font-size: 11pt; font-weight: bold; text-align:center; width:8%;">Qty</td> <td style="font-size: 11pt; font-weight: bold; text-align:center; width:16%;">Price</td> <td style="font-size: 11pt; font-weight: bold; text-align:center; width:16%;">Extended</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="100%" style="margin:auto; border:1px solid black; border-collapse: collapse;"><tr style="border-bottom: 1px solid;"> <td style="text-align:left;width:60%;"><%# Eval("product_description")%></td> <td style="text-align:center;width:8%;"><%# Eval("qty_sold") %></td> <td style="text-align:right;width:16%;"><%# String.Format("{0:c}", Convert.ToDouble(Eval("price_sold"))) %></td> <td style="text-align:right;width:16%;"><%# String.Format("{0:c}", Convert.ToDouble(Eval("cart_extended")))%></td> </tr></table> </ItemTemplate> </asp:Repeater> <table width="100%" style="margin:auto; border:1px solid black; border-collapse: collapse;"> <tr><td colspan="3"> </td></tr> <tr> <td style="width:68%;"></td> <td style="width:16%; text-align:right;">SubTotal:</td> <td style="width:16%; text-align:right;"><asp:Label ID="lblSubtotal" runat="server"></asp:Label></td> </tr> <tr> <td style="text-align:left; width:68%;">Payment Method: <asp:Label ID="lblPmtMethod" runat="server"></asp:Label></td> <td style="width:16%; text-align:right;">Discount:</td> <td style="width:16%; text-align:right;"><asp:Label ID="lblDiscount" runat="server"></asp:Label></td> </tr> <tr> <td style="text-align:left; width:68%;">Billed To: <asp:Label ID="lblFtrCustName" runat="server"></asp:Label></td> <td style="width:16%; text-align:right;">Sales Tax:</td> <td style="width:16%; text-align:right;"><asp:Label ID="lblSalesTax" runat="server"></asp:Label></td> </tr> <tr> <td style="text-align:left; width:68%;"><asp:Label ID="lblInvoiceBalanceDue" Font-Bold="true" runat="server"></asp:Label></td> <td style="width:16%; text-align:right;">Grand Total:</td> <td style="width:16%; text-align:right;"><asp:Label ID="lblGndTot" runat="server"></asp:Label></td> </tr> <tr><td colspan="3"> </td></tr> </table> </asp:Panel> </div> </form> </body> </html>
protected void btnPrinting_Click(object sender, EventArgs e) { //- Use the Javascript PrintDialog Instead. //-Must either reference the ncTools or added to the bin folder //- Default [W=300 X H=300 Portrait] ncTools.PrintHelper.btnPrint_Click(this.Page, pnl1); //- Or your own settings [W=800 X H=600 Landscape] ncTools.PrintHelper.btnPrint_Click(this.Page, pnl1,800,600,ncTools.eOrientation.Landscape); //- Only use one instance of the Object either the default one or your own settings. }
Trouble logging in? Simply enter your email address OR username in order to reset your password.
For faster and more reliable delivery, add support@netstair.us to your trusted senders list in your email software.