I am having a problem with cross page referencing. I have two pages, one with a form to be fille w/ information about the employee (EnterData.aspx) and the other with a table to subtract taxes and to calculate the net income(DisplayData.aspx).
I keep getting an error stating:
In my EnterData.aspx.cs it appears that the class name (EnterData) is not changing color like it should. I have tried other names and various ways of calling it but to no avail. . . I'll post the code below.
THANK YOU in advance for helping me.
EnterData.aspx.cs
DisplayData.aspx.cs
I keep getting an error stating:
Code:
Error 2 The type or namespace name 'EnterData' could not be found (are you missing a using directive or an assembly reference?) C:UsersM1330DocumentsVisual Studio 2005WebSitesHomework 2DisplayData.aspx.cs 17 21 C:...Homework 2
THANK YOU in advance for helping me.
EnterData.aspx.cs
Code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class EnterData : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string GetEmpID
{
get
{
return txtEmployeeID.Text;
}
}
public string GetEmpName
{
get
{
return txtEmpName.Text;
}
}
public decimal GetHours
{
get
{
return Double.Parse(txtHours);
}
}
public Double GetType
{
get
{
if (rdbEmpCasualLaborer.Checked)
type = 7.75;
if (rdbEmpApprentice.Checked)
type = 10.65;
if (rdbEmpJourneyman.Checked)
type = 15.75;
return type;
}
}
}
Code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class DisplayData : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
EnterData prevPage = prevPage = (EnterData) PreviousPage;
Double grossPay = (prevPage.GetType) *
(prevPage.GetHours);
string empName = prevPage.GetEmpName;
string empID = prevPage.GetEmpID;
// -----------Setup row 1 ------------------
TableRow tr1 = new TableRow();
tr1.Font.Bold = true;
// Set up cells for row 1
TableCell r1c1 = new TableCell();
r1c1.Text = "Description";
r1c1.Width = 100;
TableCell r1c2 = new TableCell();
r1c2.Text = "Amount";
r1c2.Width = 100;
//Add cells to row 1
tr1.Cells.Add(r1c1);
tr1.Cells.Add(r1c2);
// ----------- Setup Row 2 ------------------
TableRow tr2 = new TableRow();
TableCell r2c1 = new TableCell();
r2c1.Text = "Gross Pay";
r2c1.Width = 100;
TableCell r2c2 = new TableCell();
r2c2.Text = grossPay.ToString();
r2c2.Width = 100;
// ----------- Setup Row 3 ------------------
TableRow tr3 = new TableRow();
TableCell r3c1 = new TableCell();
r3c1.Text = " ";
r3c1.Width = 100;
TableCell r3c2 = new TableCell();
r3c2.Text = " ";
r3c2.Width = 100;
// ----------- Setup Row 4 ------------------
TableRow tr4 = new TableRow();
TableCell r4c1 = new TableCell();
r4c1.Text = "Federal Income Tax";
r4c1.Width = 100;
TableCell r4c2 = new TableCell();
double deduction1 = grossPay * .185;
r4c2.Text = "$" + deduction1;
r4c2.Width = 100;
// ----------- Setup Row 5 ------------------
TableRow tr5 = new TableRow();
TableCell r5c1 = new TableCell();
r5c1.Text = "State Income Tax";
r5c1.Width = 100;
TableCell r5c2 = new TableCell();
double deduction2 = grossPay * .032;
r5c2.Text = "$" + deduction2;
r5c2.Width = 100;
// ----------- Setup Row 6 ------------------
TableRow tr6 = new TableRow();
TableCell r6c1 = new TableCell();
r6c1.Text = "Social Security Tax";
r6c1.Width = 100;
TableCell r6c2 = new TableCell();
double deduction3 = grossPay * .0585;
r6c2.Text = "$" + deduction3;
r6c2.Width = 100;
// ----------- Setup Row 7 ------------------
TableRow tr7 = new TableRow();
TableCell r7c1 = new TableCell();
r7c1.Text = "Medicare/Medicaid Tax";
r7c1.Width = 100;
TableCell r7c2 = new TableCell();
double deduction4 = grossPay*.0075;
r7c2.Text = "$" + deduction4;
r7c2.Width = 100;
// ----------- Setup Row 8 ------------------
TableRow tr8 = new TableRow();
TableCell r8c1 = new TableCell();
r8c1.Text = "Pension Plan";
r8c1.Width = 100;
TableCell r8c2 = new TableCell();
double deduction5 = grossPay*.005;
r8c2.Text = "$" + deduction5;
r8c2.Width = 100;
// ----------- Setup Row 9 ------------------
TableRow tr9 = new TableRow();
TableCell r9c1 = new TableCell();
r9c1.Text = "Health Insurance";
r9c1.Width = 100;
TableCell r9c2 = new TableCell();
double deduction6 = 5.15;
r9c2.Text = "$" + deduction6;
r9c2.Width = 100;
// ----------- Setup Row 10 ------------------
TableRow tr10 = new TableRow();
TableCell r10c1 = new TableCell();
r10c1.Text = " ";
r10c1.Width = 100;
TableCell r10c2 = new TableCell();
r10c2.Text = " ";
r10c2.Width = 100;
// ----------- Setup Row 11 ------------------
TableRow tr11 = new TableRow();
TableCell r11c1 = new TableCell();
r11c1.Text = "Net Income";
r11c1.Width = 100;
TableCell r11c2 = new TableCell();
double netPay = grossPay - deduction1 - deduction2
- deduction3 - deduction4 - deduction5
- deduction6;
r11c2.Text = netPay.ToString();
r11c2.Width = 100;
}
}




