URGENT URGENT URGENT:Javascript does not output to printer. Please see code below.

Receipt.aspx
===========
<%@ Register TagPrefix="mspos" TagName="footer" Src="~/Engine/Controls/footer.ascx" %>
<%@ Register TagPrefix="mspos" TagName="header" Src="Engine/Controls/header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="logout" Src="Engine/Controls/logout.ascx" %>
<%@ Page Language="c#" Codebehind="Receipts.aspx.cs" AutoEventWireup="false" Inherits="MSPOS.Receipts" CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"'%>
<%@ Register TagPrefix="cc1" Namespace="ActiveUp.WebControls" Assembly="ActiveDateTime" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
      <HEAD>
      <script language="javascript">
      function OpenNewWin(Receipt)
      {
     winNew = window.open("print.aspx?","printwindow","toolbar=no,scrollbar=no,height=200,width=300,resizable=no,top=200,left=200");
     var PrintHtml ="<Table cellpadding=5 cellspacing=5 broder=0>";
           PrintHtml = PrintHtml + "<TR><TD>Receipt</TD><TD width=5>:</TD><TD>" + Receipt + "</TD></TR>";
           PrintHtml = PrintHtml + " </TABLE>";
           PrintHtml = PrintHtml + " <DIV id=butPanel align=center> <input Type=button value='   Print  ' onclick=Javascript:document.getElementById('butPanel').style.display='none';window.print();document.getElementById('butPanel').style.display='';>";
           PrintHtml = PrintHtml + " <input type=button value=cancel onclick=javascript:window.close();></Div>";
           winNew.document.body.innerHTML=PrintHtml;
           winNew.focus();
      }
      </script>
      </HEAD>
      <BODY leftMargin="0" background="images/bg.gif" topMargin="0">
            <form id="Form1" action="database.aspx" method="post" runat="server">
                  <strong>
                        <P><mspos:header id="Header1" runat="server"></mspos:header><BR>
                              <FONT face="Verdana" size="2"></FONT>
                        </P>
                        <FONT face="Verdana" size="2">
                              <P align="center">
                                    <asp:ImageButton id="MainMenu" runat="server" ImageUrl="images/mainmenu.jpg"></asp:ImageButton></P>
                        </FONT><FONT face="Verdana" size="2">
                              <DIV align="center">
                                    <TABLE id="Table2" height="118" cellSpacing="1" cellPadding="1" width="355" border="0">
                                          <TR>
                                                <TD vAlign="top" width="147" colSpan="1" rowSpan="4">
                                                      <P><asp:radiobuttonlist id="Group_RadioButtonList" runat="server" BorderWidth="0px" CellSpacing="1" CellPadding="1"
                                                                  Height="111px" Font-Bold="True" Font-Size="12px" Font-Names="Verdana" Width="35px" BackColor="#FEF9E9">
                                                                  <asp:ListItem Value="PayNumber">1</asp:ListItem>
                                                                  <asp:ListItem Value="Cashier">2</asp:ListItem>
                                                                  <asp:ListItem Value="StartDate">3</asp:ListItem>
                                                            </asp:radiobuttonlist></P>
                                                      &nbsp;&nbsp;
                                                </TD>
                                                <TD noWrap colSpan="1" rowSpan="1">Payment Number:</TD>
                                                <TD vAlign="middle" noWrap width="200" colSpan="1" rowSpan="1"><asp:textbox id="txtPayment" runat="server" MaxLength="10"></asp:textbox></TD>
                                          </TR>
                                          <TR>
                                                <TD width="240">Cashier Number:</TD>
                                                <TD><asp:textbox id="txtCashier" runat="server" MaxLength="8"></asp:textbox></TD>
                                          </TR>
                                          <TR>
                                                <TD width="240" height="10">Start Date:</TD>
                                                <TD height="10"><cc1:activedatetime id="ActiveDateTime3" runat="server" AllowNull="False" MonthNamesDisabled="True"
                                                            Format="DAY;-;MONTH;-;YEAR"></cc1:activedatetime></TD>
                                          </TR>
                                          <TR>
                                                <TD width="240">End Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                </TD>
                                                <TD><cc1:activedatetime id="ActiveDateTime4" runat="server" AllowNull="False" MonthNamesDisabled="True"
                                                            Format="DAY;-;MONTH;-;YEAR"></cc1:activedatetime></TD>
                                          </TR>
                                          <TR>
                                                <TD width="240"></TD>
                                                <TD><asp:button id="btnRunQuery" onclick="btnRunQuery_Click" runat="server" text="Run Query" type="submit"></asp:button></TD>
                                          </TR>
                                    </TABLE>
                              </DIV>
                        </FONT></strong>
                  <DIV>
                        <br>
                        <strong>Results of:<BR>
                        </strong>
                  </DIV>
                  <DIV align="center">
                        <asp:datagrid id="ReceiptsDataGrid" runat="server" BorderWidth="3" CellSpacing="1" CellPadding="1"
                              Height="144px" Width="500px"  OnItemDataBound="ReceiptsDataGrid_ItemDataBound" OnItemCommand="ReceiptsDataGrid_ItemCommand" HeaderStyle-Font-Bold="True"
                              maintainviewstate="false" GridLines="None" BorderStyle="Outset" font-size="XX-Small" font-names="Verdana"
                              BorderColor="#CCCC99" AutoGenerateColumns="False">
                              <AlternatingItemStyle Wrap="False" BackColor="PaleGoldenrod"></AlternatingItemStyle>
                              <ItemStyle Wrap="False" BackColor="Beige"></ItemStyle>
                              <HeaderStyle Font-Size="14px" Font-Bold="True" ForeColor="White" BackColor="#954896"></HeaderStyle>
                              <Columns>
                                    <asp:BoundColumn DataField="RC_PAYMNB" HeaderText="Payment Number "></asp:BoundColumn>
                                    <asp:BoundColumn DataField="RC_CASHNB" HeaderText="Cash Number"></asp:BoundColumn>
                                    <asp:BoundColumn DataField="RC_DATE" HeaderText="Date"></asp:BoundColumn>
                                    <asp:BoundColumn DataField="RC_DATA" Visible="False" HeaderText="Data"></asp:BoundColumn>
                                    <asp:TemplateColumn>
                                          <ItemTemplate>
                                                <asp:Button CommandName="View" Text="View" Runat="server" ID="Button1"></asp:Button>
                                          </ItemTemplate>
                                    </asp:TemplateColumn>
                                    <asp:TemplateColumn>
                                          <ItemTemplate>
                                                <asp:Button CommandName="Print" Text="Print" Runat="server" ID="Button2"></asp:Button>
                                          </ItemTemplate>
                                    </asp:TemplateColumn>
                              </Columns>
                        </asp:datagrid>
                        <P align="center">
                              <uc1:logout id="Logout1" runat="server"></uc1:logout></P>
            </form>
            </DIV></FORM>
      </BODY>
</HTML>



Receipt.cs
===========
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Drawing;
using System.Data.Common;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Data.Odbc;
namespace MSPOS
{
      /// <summary>
      /// Summary description for Receipts.
      /// </summary>
      public class Receipts : System.Web.UI.Page
      {
            protected System.Web.UI.WebControls.RadioButtonList Group_RadioButtonList;
            protected System.Web.UI.WebControls.DataGrid ReceiptsDataGrid;
            private DataSet ddlDataSet = new DataSet();
            private OdbcConnection myConnection =  new OdbcConnection("DSN=POS;UID=system;PWD=system");
            protected System.Web.UI.WebControls.Button btnRunQuery;
            protected System.Web.UI.WebControls.Button Button2;
            
            protected System.Web.UI.WebControls.TextBox txtPayment;
            protected System.Web.UI.WebControls.TextBox txtCashier;
            
            private DataSet ddlDataSet1 = new DataSet();
            private DataSet ddlDataSet2 = new DataSet();
            protected ActiveUp.WebControls.ActiveDateTime ActiveDateTime3;
            protected ActiveUp.WebControls.ActiveDateTime ActiveDateTime4;
            private DataSet ddlDataSet3 = new DataSet();
            protected System.Web.UI.WebControls.ImageButton MainMenu;
            protected System.Web.UI.WebControls.Button Button1;
            protected string AccessLevel = null;

            private void Page_Load(object sender, System.EventArgs e)
            {
                  // Put user code to initialize the page here
                  if (!Page.IsPostBack)
                  {
                        ActiveDateTime3.Date = System.DateTime.Today.Date;
                        ActiveDateTime4.Date = System.DateTime.Today.Date;
                  }
            }

            private void MainMenu_Click(Object sender, ImageClickEventArgs e)
            {
                  AccessLevel = Session["Authenticated"].ToString();
                  if (AccessLevel == "1")
                        Response.Redirect("AdminStart.aspx");        
                  else if (AccessLevel == "2")
                        Response.Redirect("CCManStart.aspx");        
                  else if (AccessLevel == "3")
                        Response.Redirect("CCashierStart.aspx");        
                  else if (AccessLevel == "4")
                        Response.Redirect("CashierStart.aspx");        
                  else Response.Redirect("Error.aspx");
            }


            #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                  //
                  // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                  //
                  InitializeComponent();
                  base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {    
                  this.MainMenu.Click += new System.Web.UI.ImageClickEventHandler(this.MainMenu_Click);
                  this.Group_RadioButtonList.SelectedIndexChanged += new System.EventHandler(this.Group_RadioButtonList_SelectedIndexChanged);
                  this.txtCashier.TextChanged += new System.EventHandler(this.txtCashier_TextChanged);
                  this.btnRunQuery.Click += new System.EventHandler(this.btnRunQuery_Click);
                  this.Load += new System.EventHandler(this.Page_Load);

            }
            #endregion

            public string DecodeReceipt (string szBill)
            {
                  string szNewBill="";
                             
                  // Create an ASCII encoding.
                  Encoding ascii = Encoding.ASCII;
                       
                  Byte[] encodedBytes = ascii.GetBytes(szBill);

                  foreach (Byte a in encodedBytes)
                  {
                        if ( a ==10 || a ==15 ||a==18 ||a ==27)
                        {}          
                        else if (a == 13)
                              szNewBill = szNewBill + "\\n";
                        else
                              szNewBill = szNewBill +(char) a;

                  }
                  return szNewBill;
            }
         


            private void txtPayment_TextChanged(object sender, System.EventArgs e)
            {
            
            }

            private void txtCashier_TextChanged(object sender, System.EventArgs e)
            {
            
            }

            //***********************************************************************
            // Get RC_PAYMND and populate dataset
            public DataSet BindRC_PAYMND(string searchstring)
            {
                  OdbcConnection myConnection =  new OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet1
                  myConnection.Open();
                  string strSQLDDL = @"SELECT RC_PAYMNB FROM TBRECEIPTS WHERE RC_PAYMNB='"+searchstring+"'";
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
                  ddlDataSet1.Clear();  
                  myDataAdapter.Fill(ddlDataSet1, "ddlRC_PAYMNB");
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  strSQLDDL = null;
                  return ddlDataSet1;
            }
            //***********************************************************************

            //***********************************************************************
            // Get RC_CASHND and populate dataset
            public DataSet BindRC_CASHND(string searchstring)
            {
                  OdbcConnection myConnection =  new OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet2
                  myConnection.Open();
                  string strSQLDDL = @"SELECT RC_CASHNB FROM TBRECEIPTS WHERE RC_CASHNB='"+searchstring+"'";
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
                  ddlDataSet2.Clear();  
                  myDataAdapter.Fill(ddlDataSet2, "ddlRC_CASHNB");
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  strSQLDDL = null;
                  return ddlDataSet2;
            }
            //***********************************************************************


            //***********************************************************************
            // Get RC_CASHND and populate dataset with RC_CASHND and RC_DATE
            public DataSet BindRC_DATE()
            {
                  OdbcConnection myConnection =  new OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet3
                  myConnection.Open();
                  string strSQLDDL = @"SELECT RC_DATE FROM TBRECEIPTS";
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
                  ddlDataSet3.Clear();  
                  myDataAdapter.Fill(ddlDataSet3, "ddlRC_DATE");
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  strSQLDDL = null;
                  return ddlDataSet3;
            }
            //***********************************************************************
       
            public void ReceiptsDataGrid_ItemDataBound(object sender,System.Web.UI.WebControls.DataGridItemEventArgs e)
            {
                  if(e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType==ListItemType.Item )
                  {
                        string parsedreceipt = null;
                        string strValue="Javascript:OpenNewWin('"+ DecodeReceipt(e.Item.Cells[3].Text) + "');";
                        Button btn = ( (Button) e.Item.FindControl("Button2") );
                        Session["parsedreceipt"] = parsedreceipt;  
                        btn.Attributes.Add("Onclick",strValue);
                  
                  }


            }
            //***********************************************************************
       


            public void ReceiptsDataGrid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
            {
                  ListItemType oType = ((ListItemType)e.Item.ItemType);
                  if(oType == ListItemType.Item || oType == ListItemType.AlternatingItem)
                  {
                        e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='lightblue'");            
                        e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='Beige'");            
                  }
                  
                  if(e.CommandName =="View")
                  {
                        string parsedreceipt = null;
                        parsedreceipt = DecodeReceipt (e.Item.Cells[3].Text);
                        StringBuilder strAlert = new StringBuilder();
                        strAlert.Append("<script language=javascript> alert('");
                        strAlert.Append("Receipt:                    " + parsedreceipt + "\\n");
                        strAlert.Append("');</script>");
                        this.RegisterStartupScript("startup",strAlert.ToString());
                  }

                  if(e.CommandName =="Print")
                  {
                  ///      string parsedreceipt = null;
                  ///      parsedreceipt = DecodeReceipt (e.Item.Cells[3].Text);
                  ///      Session["parsedreceipt"] = parsedreceipt;
            ///   Response.Write("<script language=\"JavaScript\">window.OpenNewWin('print.aspx', null, 'height=200,width=400');");
                  ///      Response.Write("</script>");
                  }

                  
                  
                  

            }


            private void Group_RadioButtonList_SelectedIndexChanged(object sender, System.EventArgs e)
            {
            
            }


            public void btnRunQuery_Click(object sender, System.EventArgs e)
            {
                  string select_statement = "SELECT RC_PAYMNB, RC_CASHNB, RC_DATE, RC_DATA FROM TBRECEIPTS";
                  string DateString1 = ActiveDateTime3.Date.Day.ToString() + "-" + ActiveDateTime3.Date.Month.ToString() + "-" + ActiveDateTime3.Date.Year.ToString();
                  string DateString2 = ActiveDateTime4.Date.Day.ToString() + "-" + ActiveDateTime4.Date.Month.ToString() + "-" + ActiveDateTime4.Date.Year.ToString();

                  
                  switch (Group_RadioButtonList.SelectedIndex)
                  {
                        case 0:
                              select_statement += " Where RC_PAYMNB='" + txtPayment.Text + "'";
                              break;
                        case 1:
                              select_statement += " Where RC_CASHNB='" + txtCashier.Text + "'";
                              break;
                        case 2:
                              select_statement += " Where To_Date(RC_DATE, 'dd-mm-yyyy') <= '" + DateString2.ToString() + "' And To_Date(RC_DATE, 'dd-mm-yyyy') >= '" + DateString1.ToString() + "'";
                              break;
                  }

            

                  OdbcConnection myConnection =  new
                  OdbcConnection("DSN=POS;UID=system;PWD=system");

                  // Populate the ddlDataSet1
                  myConnection.Open();
                  string strSQLDDL = select_statement;
                  OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL,myConnection);
                  ddlDataSet1.Clear();  
                  myDataAdapter.Fill(ddlDataSet1);
                  myDataAdapter.Dispose();
                  myDataAdapter = null;
                  myConnection.Close();
                  ReceiptsDataGrid.DataSource = ddlDataSet1.Tables[0];
                  ReceiptsDataGrid.DataBind();
            
        }

            private void ReceiptsDataGrid_SelectedIndexChanged(object sender, System.EventArgs e)
            {
            
            }
            

      }
}



print.aspx
===========
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Text" %>
<%@ import namespace="System.Collections" %>
<%@ import namespace="System.ComponentModel" %>
<%@ import namespace="System.Drawing" %>
<%@ import namespace="System.Web" %>
<%@ import namespace="System.Web.SessionState" %>
<%@ import namespace="System.Web.UI" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Print page</title>
<META content="Microsoft Visual Studio 7.0" name="GENERATOR">
<META content="C#" name="CODE_LANGUAGE">
<META content="JavaScript" name="vs_defaultClientScript">
<META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
              
</HEAD>
<BODY bottomMargin="0" bgColor="#ffffff" leftMargin="0" topMargin="0" rightMargin="0"
marginwidth="0" marginheight="0" onLoad="window.print();">
<FORM id="Form1" method="post" runat="server">
<%= Server.HtmlEncode(Session["parsedreceipt"].ToString()).Replace("\\n", "<BR>") %>

</FORM>
</BODY>
</HTML>










Server Error in '/MSPOS' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30311: Value of type 'System.Web.SessionState.HttpSessionState' cannot be converted to 'String'.

Source Error:

 

Line 20: marginwidth="0" marginheight="0" onLoad="window.print();">
Line 21: <FORM id="Form1" method="post" runat="server">
Line 22: <%= Server.HtmlEncode(Session["parsedreceipt"].ToString()).Replace("\\n", "<BR>") %>
Line 23:
Line 24: </FORM>
 

Source File: C:\Inetpub\wwwroot\MSPOS\print.aspx    Line: 22



Show Detailed Compiler Output:


c:\windows\system32\inetsrv> "c:\windows\microsoft.net\framework\v1.1.4322\vbc.exe" /t:library /utf8output /R:"c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll" /R:"c:\windows\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a3a\system.web.mobile.dll" /R:"c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll" /R:"c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\mspos\103692e3\19bdc9e7\assembly\dl2\412fda75\329afd06_44b6c401\mspos.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\mspos\103692e3\19bdc9e7\_p6nhhin.dll" /R:"c:\windows\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll" /R:"c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll" /R:"c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\mspos\103692e3\19bdc9e7\assembly\dl2\18b8a94a\4e887d3b_0eb5c401\activedatetime.dll" /R:"c:\windows\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll" /R:"c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll" /out:"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\mspos\103692e3\19bdc9e7\jmusgb2d.dll" /D:DEBUG=1 /debug+ /win32resource:"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\mspos\103692e3\19bdc9e7\jmusgb2d.res"  "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\mspos\103692e3\19bdc9e7\jmusgb2d.0.vb"


Microsoft (R) Visual Basic .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322.2032
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

C:\Inetpub\wwwroot\MSPOS\print.aspx(22) : error BC30311: Value of type 'System.Web.SessionState.HttpSessionState' cannot be converted to 'String'.

            __output.Write(Server.HtmlEncode(Session["parsedreceipt"].ToString()).Replace("\\n", "<BR>"))
                                             ~~~~~~~                                                    
C:\Inetpub\wwwroot\MSPOS\print.aspx(22) : error BC30203: Identifier expected.

            __output.Write(Server.HtmlEncode(Session["parsedreceipt"].ToString()).Replace("\\n", "<BR>"))
                                                     ~~~~~~~~~~~~~~~                                    
C:\Inetpub\wwwroot\MSPOS\print.aspx(22) : error BC30205: End of statement expected.

            __output.Write(Server.HtmlEncode(Session["parsedreceipt"].ToString()).Replace("\\n", "<BR>"))
                                                                                                        ~

 



Show Complete Compilation Source:


Line 1:    '------------------------------------------------------------------------------
Line 2:    ' <autogenerated>
Line 3:    '     This code was generated by a tool.
Line 4:    '     Runtime Version: 1.1.4322.2032
Line 5:    '
Line 6:    '     Changes to this file may cause incorrect behavior and will be lost if
Line 7:    '     the code is regenerated.
Line 8:    ' </autogenerated>
Line 9:    '------------------------------------------------------------------------------
Line 10:  
Line 11:   Option Strict Off
Line 12:   Option Explicit On
Line 13:  
Line 14:   Imports ASP
Line 15:   Imports Microsoft.VisualBasic
Line 16:   Imports System
Line 17:   Imports System.Collections
Line 18:   Imports System.Collections.Specialized
Line 19:   Imports System.ComponentModel
Line 20:   Imports System.Configuration
Line 21:   Imports System.Data
Line 22:   Imports System.Drawing
Line 23:   Imports System.Text
Line 24:   Imports System.Text.RegularExpressions
Line 25:   Imports System.Web
Line 26:   Imports System.Web.Caching
Line 27:   Imports System.Web.Security
Line 28:   Imports System.Web.SessionState
Line 29:   Imports System.Web.UI
Line 30:   Imports System.Web.UI.HtmlControls
Line 31:   Imports System.Web.UI.WebControls
Line 32:  
Line 33:   Namespace ASP
Line 34:      
Line 35:       <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()>  _
Line 36:       Public Class print_aspx
Line 37:           Inherits System.Web.UI.Page
Line 38:           Implements System.Web.SessionState.IRequiresSessionState
Line 39:          
Line 40:          
Line 41:           #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",21)
Line 42:           Protected Form1 As System.Web.UI.HtmlControls.HtmlForm
Line 43:          
Line 44:           #End ExternalSource
Line 45:          
Line 46:           Private Shared __initialized As Boolean = false
Line 47:          
Line 48:           Private Shared __stringResource As Object
Line 49:          
Line 50:           Private Shared __fileDependencies As System.Collections.ArrayList
Line 51:          
Line 52:           Public Sub New()
Line 53:               MyBase.New
Line 54:               Dim dependencies As System.Collections.ArrayList
Line 55:               If (ASP.print_aspx.__initialized = false) Then
Line 56:                   ASP.print_aspx.__stringResource = System.Web.UI.TemplateControl.ReadStringResource(GetType(ASP.print_aspx))
Line 57:                   dependencies = New System.Collections.ArrayList
Line 58:                   dependencies.Add("C:\Inetpub\wwwroot\MSPOS\print.aspx")
Line 59:                   ASP.print_aspx.__fileDependencies = dependencies
Line 60:                   ASP.print_aspx.__initialized = true
Line 61:               End If
Line 62:               Me.Server.ScriptTimeout = 30000000
Line 63:           End Sub
Line 64:          
Line 65:           Protected Overrides ReadOnly Property SupportAutoEvents As Boolean
Line 66:               Get
Line 67:                   Return false
Line 68:               End Get
Line 69:           End Property
Line 70:          
Line 71:           Protected ReadOnly Property ApplicationInstance As ASP.Global_asax
Line 72:               Get
Line 73:                   Return CType(Me.Context.ApplicationInstance,ASP.Global_asax)
Line 74:               End Get
Line 75:           End Property
Line 76:          
Line 77:           Public Overrides ReadOnly Property TemplateSourceDirectory As String
Line 78:               Get
Line 79:                   Return "/MSPOS"
Line 80:               End Get
Line 81:           End Property
Line 82:          
Line 83:           Private Function __BuildControlForm1() As System.Web.UI.Control
Line 84:               Dim __ctrl As System.Web.UI.HtmlControls.HtmlForm
Line 85:              
Line 86:               #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",21)
Line 87:               __ctrl = New System.Web.UI.HtmlControls.HtmlForm
Line 88:              
Line 89:               #End ExternalSource
Line 90:               Me.Form1 = __ctrl
Line 91:              
Line 92:               #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",21)
Line 93:               __ctrl.ID = "Form1"
Line 94:              
Line 95:               #End ExternalSource
Line 96:              
Line 97:               #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",21)
Line 98:               __ctrl.Method = "post"
Line 99:              
Line 100:              #End ExternalSource
Line 101:              __ctrl.SetRenderMethodDelegate(AddressOf Me.__RenderForm1)
Line 102:              Return __ctrl
Line 103:          End Function
Line 104:          
Line 105:          Private Sub __RenderForm1(ByVal __output As System.Web.UI.HtmlTextWriter, ByVal parameterContainer As System.Web.UI.Control)
Line 106:              __output.Write(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10))
Line 107:              
Line 108:              #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",22)
Line 109:              __output.Write(Server.HtmlEncode(Session["parsedreceipt"].ToString()).Replace("\\n", "<BR>"))
Line 110:              
Line 111:              #End ExternalSource
Line 112:              __output.Write(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10))
Line 113:          End Sub
Line 114:          
Line 115:          Private Sub __BuildControlTree(ByVal __ctrl As System.Web.UI.Control)
Line 116:              Dim __parser As System.Web.UI.IParserAccessor = CType(__ctrl,System.Web.UI.IParserAccessor)
Line 117:              
Line 118:              #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",1)
Line 119:              __parser.AddParsedSubObject(Me.CreateResourceBasedLiteralControl(0, 529, true))
Line 120:              
Line 121:              #End ExternalSource
Line 122:              
Line 123:              #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",1)
Line 124:              Me.__BuildControlForm1
Line 125:              
Line 126:              #End ExternalSource
Line 127:              
Line 128:              #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",1)
Line 129:              __parser.AddParsedSubObject(Me.Form1)
Line 130:              
Line 131:              #End ExternalSource
Line 132:              
Line 133:              #ExternalSource("C:\Inetpub\wwwroot\MSPOS\print.aspx",1)
Line 134:              __parser.AddParsedSubObject(New System.Web.UI.LiteralControl(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"</BODY>"&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"</HTML>"&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)))
Line 135:              
Line 136:              #End ExternalSource
Line 137:          End Sub
Line 138:          
Line 139:          Protected Overrides Sub FrameworkInitialize()
Line 140:              SetStringResourcePointer(ASP.print_aspx.__stringResource, 529)
Line 141:              Me.__BuildControlTree(Me)
Line 142:              Me.FileDependencies = ASP.print_aspx.__fileDependencies
Line 143:              Me.EnableViewStateMac = true
Line 144:              Me.Request.ValidateInput
Line 145:          End Sub
Line 146:          
Line 147:          Public Overrides Function GetTypeHashCode() As Integer
Line 148:              Return -2025760662
Line 149:          End Function
Line 150:      End Class
Line 151:  End Namespace
Line 152:  
 


mathieu_cuprykAsked:
Who is Participating?
 
ryerrasCommented:
If you look deeper into your code, you are not setting Session["parsedreceipt"] to any valid string or any other value.

in the method public void ReceiptsDataGrid_ItemDataBound(object sender,System.Web.UI.WebControls.DataGridItemEventArgs e)
 you are setting Session["parsedreceipt"] to a string, but you initialize that string to null and so you are assigning a null to that session variable.
  string parsedreceipt = null;
                    string strValue="Javascript:OpenNewWin('"+ DecodeReceipt(e.Item.Cells[3].Text) + "');";
                    Button btn = ( (Button) e.Item.FindControl("Button2") );
                    Session["parsedreceipt"] = parsedreceipt;  
                    btn.Attributes.Add("Onclick",strValue);

I dont see anywhere else you are setting the value of Session["parsedreceipt"] to anything else, you are only accessing its value in other places. So, it seemed to be storing a null. I guess that could be a problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.