错误消息不断弹出。另外,当我运行代码时,它似乎根本不起作用。我正在尝试将数据传递到另一个页面。有什么建议吗?这是主页代码,
public partial class _Default : System.Web.UI.Page
{
static int numBeachBookingInt = 0;
static int numBushBookingInt = 0;
static decimal totRevenue = 0;
protected void Page_Load(object sender, EventArgs e)
{
string totalRevenue;
if (Convert.ToString(Session["confirmBooking"]) == "confirm" && Convert.ToString(Session["bachType"]) == "bush")
{
totalRevenue = (string)(Session["totalRevenue"]);
totRevenue += decimal.Parse(totalRevenue);
totRevenueLabel.Text = String.Format("{0:c}", totRevenue);
numBushBooking += 1;
numBushHouseLabel.Text = numBushBooking.ToString();
Session["confirmBooking"] = "no current booking";
Session["bachType"] = "none";
}
else if (Convert.ToString(Session["confirmBooking"]) == "confirm" && Convert.ToString(Session["bachType"]) == "beach")
{
totalRevenue = (string)(Session["totalRevenue"]);
totRevenue += decimal.Parse(totalRevenue);
totRevenueLabel.Text = String.Format("{0:c}", totRevenue);
numBeachBooking += 1;
numBeachHouseLabel.Text = numBeachBooking.ToString();
Session["confirmBooking"] = "no current booking";
Session["bachType"] = "none";
}
numBeachHouseLabel.Text = numBeachBooking.ToString();
numBushHouseLabel.Text = numBushBooking.ToString();
这是第二个。
protected void confirmButton_Click(object sender, EventArgs e)
{
Session["confirmBooking"] = "confirm";
Session["totalRevenue"] = totalRateLabel.Text;
switch (bachTypeRadioButtonList.Text)
{
case "Beach":
Session["bachType"] = "beach";
break;
case "Bush":
Session["bachType"] = "bush";
break;
default:
Session["bachType"] = "none";
break;
}
Response.Redirect("MainBookingForm.aspx");
}