//Save Data protected void Button1_Click(object sender, EventArgs e) { if (Page.IsValid) { Hashtable ht = new Hashtable(); ht["kind"] = ViewState["kind"].ToString(); ht["zcid"] = ViewState["parentid"].ToString(); ht["bkind"] = ViewState["Bkind"].ToString(); ht["zeren"] = User.Identity.Name; ht["remark"] = this.remark.Text; ht["didian"] = didian.Text; ht["jieguo"] = jieguo.Text; ht["remark1"] = this.remark1.Text; U_ZCTCBU tc1 = new U_ZCTCBU(); if (ViewState["id"] == null) { tc1.InsertData(ht); //Add a data } else { tc1.EditTc(ViewState["id"].ToString(), ht); //Edit tc } tc1.Close(); if (ViewState["Bkind"].ToString() == "0") { if (Int32.Parse(ViewState["kind"].ToString()) >= 20) { Response.Redirect("ZcDetail4.aspx?id=" + ViewState["parentid"].ToString(), true); } else { Response.Redirect("ZcDetail2.aspx?id=" + ViewState["parentid"].ToString(), true); } } else { if (Int32.Parse(ViewState["kind"].ToString()) >= 20) { Response.Redirect("ZcBaoDetail4.aspx?id=" + ViewState["parentid"].ToString(), true); } else { Response.Redirect("ZcBaoDetail2.aspx?id=" + ViewState["parentid"].ToString(), true); } } } }