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; } } } }
//protected void lvContactList_ItemDeleting(object sender, ListViewDeleteEventArgs e) //{ // DBLL.DBcommon dbcom = new DBLL.DBcommon(); // Label lblnID = (Label)lvContactList.Items[e.ItemIndex].FindControl("lblnLinkID"); // int _nID = 0; // if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0) // { // hfContactUpdateID.Value = _nID.ToString(); // } // dbcom.sp_DeleteNormalTableByID(int.Parse(hfContactUpdateID.Value), "tb_Link"); // ReBindPageList(); //} protected void lvContactListt_SelectedIndexChanging(object sender, ListViewSelectEventArgs e) { Label lblnID = (Label)lvContactList.Items[e.NewSelectedIndex].FindControl("lblnContactID"); int _nID = 0; DBLL.clsContact Contact = new DBLL.clsContact(); if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0) { MultiView1.ActiveViewIndex = 1; DataTable dt = Contact.Select_tb_ContactBynContactID(_nID); txtsTitle.Text = dt.Rows[0]["sTitle"].ToString(); txtsName.Text = dt.Rows[0]["sName"].ToString(); txtsCompanyName.Text = dt.Rows[0]["sCompanyName"].ToString(); txtsAddress.Text = dt.Rows[0]["sAddress"].ToString(); txtsEmail.Text = dt.Rows[0]["sEmail"].ToString(); txtsFax.Text = dt.Rows[0]["sFax"].ToString(); txtsPhone.Text = dt.Rows[0]["sPhone"].ToString(); txtsContents.Text = dt.Rows[0]["sContents"].ToString(); hfContactListUpdateID.Value = _nID.ToString(); } }