protected void BtnUpdate_Click(object sender, EventArgs e) { //判断session if (Session["User"] == null || Session["User"].ToString().Length < 1) { Response.Redirect(Request.RawUrl); } try { //if (ValiEdit()) //{ DBLL.clsContact Contact = new DBLL.clsContact(); DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); bool _Result = Contact.update_tb_ContactBynContactID(int.Parse(hfContactListUpdateID.Value), txtsTitle.Text, txtsName.Text, txtsCompanyName.Text, txtsAddress.Text, txtsEmail.Text, txtsFax.Text, txtsPhone.Text, txtsContents.Text, Session["user"].ToString(), DateTime.Now, true, 0, true); if (_Result == true) { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess"); ShowMsg1.Show(); MultiView1.ActiveViewIndex = 0; ReBindPageList(); } else { //失败就一条 ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail"); ShowMsg1.Show(); } //} } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int nID = 0; if (Request.QueryString["nID"] != null && int.TryParse(Request.QueryString["nID"].ToString(), out nID) && nID > 0) { lblBigtitle.Text = "留言明细"; DBLL.clsContact clContact = new DBLL.clsContact(); DataTable dt = clContact.Select_tb_ContactBynContactID(nID); if (dt != null && dt.Rows.Count > 0) { hfID.Value = dt.Rows[0]["nContactID"].ToString(); txtsName.Text = dt.Rows[0]["sName"].ToString(); txtsCompanyName.Text = dt.Rows[0]["sCompanyName"].ToString(); txtsPhone.Text = dt.Rows[0]["sPhone"].ToString(); txtsPositon.Text = dt.Rows[0]["sPositon"].ToString(); txtsEmail.Text = dt.Rows[0]["sEmail"].ToString(); txtsWeb.Text = dt.Rows[0]["sWeb"].ToString(); txtsContent.Text = dt.Rows[0]["sContents"].ToString(); //绑定数据 } try { bool _Result = clContact.update_tb_ContactBynContactID(nID, true); } catch (Exception) { throw; } } } }