错误为:无法将类型为“ASP.datainsert_checktool_aspx”的对象强制转换为类型“toolinsert3”。我的意图:由toolinsert3.aspx传值到checkTool.aspx
toolinsert3.aspx代码如下:
public partial class toolinsert3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
public string gjmcText
{
get
{
return this.TextBox1 .Text ;
}
set
{
this.TextBox1 .Text = value;
}
} public string gjlxText
{
get
{
return this.DropDownList1 .SelectedItem .Text ;
}
set
{
this.DropDownList1.SelectedItem.Text = value;
}
} public string gjxhText
{
get
{
return this.TextBox2.Text;
}
set
{
this.TextBox2.Text = value;
}
}
public string jscsText
{
get
{
return this.TextBox3 .Text ;
}
set
{
this.TextBox3.Text = value;
}
}
public string zyjgText
{
get
{
return this.TextBox4.Text;
}
set
{
this.TextBox4.Text = value;
}
}
public string xnyqText
{
get
{
return this.TextBox5.Text;
}
set
{
this.TextBox5.Text = value;
}
}
public string syfwText
{
get
{
return this.TextBox6.Text;
}
set
{
this.TextBox6.Text = value;
}
}
public string gzylText
{
get
{
return this.TextBox7.Text;
}
set
{
this.TextBox7.Text= value;
}
}
//public string tpText
//{
// get
// {
// return FileUpload1.PostedFile .FileName ;
// }
//} protected void btntijiao_Click(object sender, EventArgs e)
{
if (TextBox1.Text != "" && DropDownList1.SelectedItem.Text != "" & TextBox2.Text != "" && TextBox3.Text != "" )
{
Server.Transfer("checkTool.aspx");
//Server.Transfer("checkTool.aspx",true); } else
{
Response.Write(" <script language=javascript>alert('前三项为必填项'); </script>"); }
}
checkTool.aspx代码如下:]public partial class dataInsert_checkTool : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//toolinsert3 queryPage = (toolinsert3)Context.Handler; toolinsert3 queryPage = (toolinsert3)Context.Handler;这出错! Labelgjmc.Text = queryPage.gjmcText;
Labelgjlx.Text = queryPage.gjlxText;
Labelgjxh.Text = queryPage.gjxhText;
Labeljscs.Text = queryPage.jscsText;
Labelzyjg.Text = queryPage.zyjgText;
Labelxnyq.Text = queryPage.xnyqText;
Labelsyfw.Text = queryPage.syfwText;
Labelgzyl.Text = queryPage.gzylText;
//Labelpicpath.Text = queryPage.tpText;
//Image1.ImageUrl = "." + Labelpicpath.Text;
}
Button1.Attributes["onclick"] = "return confirm(' 你是否想入库');";
}
toolinsert3.aspx代码如下:
public partial class toolinsert3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
public string gjmcText
{
get
{
return this.TextBox1 .Text ;
}
set
{
this.TextBox1 .Text = value;
}
} public string gjlxText
{
get
{
return this.DropDownList1 .SelectedItem .Text ;
}
set
{
this.DropDownList1.SelectedItem.Text = value;
}
} public string gjxhText
{
get
{
return this.TextBox2.Text;
}
set
{
this.TextBox2.Text = value;
}
}
public string jscsText
{
get
{
return this.TextBox3 .Text ;
}
set
{
this.TextBox3.Text = value;
}
}
public string zyjgText
{
get
{
return this.TextBox4.Text;
}
set
{
this.TextBox4.Text = value;
}
}
public string xnyqText
{
get
{
return this.TextBox5.Text;
}
set
{
this.TextBox5.Text = value;
}
}
public string syfwText
{
get
{
return this.TextBox6.Text;
}
set
{
this.TextBox6.Text = value;
}
}
public string gzylText
{
get
{
return this.TextBox7.Text;
}
set
{
this.TextBox7.Text= value;
}
}
//public string tpText
//{
// get
// {
// return FileUpload1.PostedFile .FileName ;
// }
//} protected void btntijiao_Click(object sender, EventArgs e)
{
if (TextBox1.Text != "" && DropDownList1.SelectedItem.Text != "" & TextBox2.Text != "" && TextBox3.Text != "" )
{
Server.Transfer("checkTool.aspx");
//Server.Transfer("checkTool.aspx",true); } else
{
Response.Write(" <script language=javascript>alert('前三项为必填项'); </script>"); }
}
checkTool.aspx代码如下:]public partial class dataInsert_checkTool : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//toolinsert3 queryPage = (toolinsert3)Context.Handler; toolinsert3 queryPage = (toolinsert3)Context.Handler;这出错! Labelgjmc.Text = queryPage.gjmcText;
Labelgjlx.Text = queryPage.gjlxText;
Labelgjxh.Text = queryPage.gjxhText;
Labeljscs.Text = queryPage.jscsText;
Labelzyjg.Text = queryPage.zyjgText;
Labelxnyq.Text = queryPage.xnyqText;
Labelsyfw.Text = queryPage.syfwText;
Labelgzyl.Text = queryPage.gzylText;
//Labelpicpath.Text = queryPage.tpText;
//Image1.ImageUrl = "." + Labelpicpath.Text;
}
Button1.Attributes["onclick"] = "return confirm(' 你是否想入库');";
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货