我有一张表格供客户填写,因此我决定将其制作为数字表格。我有三个页面subscriber_details、Package_Selection 和Bank_Details。当用户在第一个字段中填写了所有字段并单击下一步时,页面会进入下一个页面,直到所有三个字段都已填写完毕,当所有三个字段都填写完毕后,他们会直接进入最后一页,最后一次将所有详细信息呈现给他们,以便他们可以确保其正确...在我的subscriber_details.aspx 我有以下代码将他们的详细信息存储到会话中
protected void btnNext_Click(object sender, EventArgs e)
{
Session["FullName"] = txtFullName.Text;
if (txtCompanyName.Text == String.Empty)
Session["CompanyName"] = "N/A";
else
Session["CompanyName"] = txtCompanyName.Text;
if (txtVAT.Text == String.Empty)
Session["VAT"] = "N/A";
else
Session["VAT"] = txtVAT.Text;
Session["ContactNumber"] = txtContactNumber.Text;
if (txtFax.Text == String.Empty)
Session["Fax"] = "N/A";
else
Session["Fax"] = txtFax.Text;
if (txtDistrict.Text == String.Empty)
Session["District"] = "N/A";
else
Session["District"] = txtDistrict.Text;
Session["City"] = txtCity.Text;
Session["Street"] = txtStreet.Text;
Session["Code"] = txtPostal.Text;
if (txtTrading.Text == String.Empty)
Session["Trading"] = "N/A";
else
Session["Trading"] = txtTrading.Text;
Session["ID"] = txtID.Text;
Session["ContactPerson"] = txtContactPerson.Text;
if (txtEmail.Text == String.Empty)
Session["Email"] = "N/A";
else
Session["Email"] = txtEmail.Text;
}
然后在我的 final.aspx 上,我有以下代码来使用会话并替换标签中的文本
protected void Page_Load(object sender, EventArgs e)
{
lblFullName.Text = Session["FullName"].ToString();
lblCompanyName.Text = Session["CompanyName"].ToString();
lblVat.Text = Session["VAT"].ToString();
lblContactNumber.Text = Session["ContactNumber"].ToString();
lblFax.Text = Session["Fax"].ToString();
lblDistrict.Text = Session["District"].ToString();
lblStreet.Text = Session["Street"].ToString();
lblCity.Text = Session["City"].ToString();
lblCode.Text = Session["Code"].ToString();
lblTrading.Text = Session["Trading"].ToString();
lblID.Text = Session["ID"].ToString();
lblContactPerson.Text = Session["ContactPerson"].ToString();
lblMail.Text = Session["Email"].ToString();
}
出于某种原因,我收到“对象引用错误”,是因为我的 final.aspx 页面不是我的下一页,因为我必须先通过我的 package.aspx 和 bank_details.aspx?
我在没有 if 语句的会话上需要字段验证器,因此文本不会为空