protected void btnBack_Click(object sender, EventArgs e)
{
Response.Redirect("~/Default.aspx");
}
protected void btnSave_Click(object sender, EventArgs e)
{
string sql = "insert into Houseinformation(HousingID) values('" + txtHousingID.Text + "')";
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
if (cmd.ExecuteNonQuery() > 0)
{
Response.Write("<script>window.Close</script>");
Response.Redirect("~/Default.aspx");
}
else
{
Response.Write("插入失败!!!");
}
}
你这个方法写的有些问题,一、在page_load中就跳转到Default.aspx,那么btnSave_Click方法应该是没有办法执行到的,从模态窗口跳到主窗口,中需要关闭和模态窗口就可以了啊