protected void btnSave_Click(object sender, EventArgs e) { this.lblMsg.Text = string.Empty; for (int i = 0; i < this.GridView1.Rows.Count; i++) { Bmk bmk = Bmk.FindById((long)this.GridView1.DataKeys[i].Value); CheckBoxList cbl = (CheckBoxList)this.GridView1.Rows[i].FindControl("CheckBoxList1"); string str = string.Empty; foreach (ListItem item in cbl.Items) { if (item.Selected) { str += item.Value; } } if (str.Length == 2 && str != bmk.tcxm) { bmk.tcxm = str; bmk.Save(); } else if (String.IsNullOrEmpty(str)) { bmk.tcxm = string.Empty; bmk.Save(); } else if (str.Length != 2) { this.lblMsg.Text += bmk.xm + "的数据录入有误:" + str + "<br />"; } } if (!string.IsNullOrEmpty(this.lblMsg.Text)) { // JsUtil.MessageBox(this,this.lblMsg.Text); } }
private void SaveData() { this.lblMsg.Text = string.Empty; for (int i = 0; i < this.GridView1.Rows.Count; i++) { Bmk bmk = Bmk.FindById((long)this.GridView1.DataKeys[i].Value); TextBox txtKm8 = (TextBox)this.GridView1.Rows[i].FindControl("txtKm8"); bmk.km8 = txtKm8.Text; bmk.Save(); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { long id = (long)this.GridView1.DataKeys[e.RowIndex].Value; Bmk stu = Bmk.FindById(id); if (stu != null) { Leafing.Core.Logging.Logger.Default.Info(string.Format("{0}删除了报考学生信息{1}", this.User.Identity, stu.Json())); stu.Delete(); } this.BindData(); }
protected void btnSave_Click(object sender, EventArgs e) { this.lblMsg.Text = string.Empty; for (int i = 0; i < this.GridView1.Rows.Count; i++) { Bmk bmk = Bmk.FindById((long)this.GridView1.DataKeys[i].Value); TextBox txtKm61 = (TextBox)this.GridView1.Rows[i].FindControl("txtKm61"); TextBox txtKm62 = (TextBox)this.GridView1.Rows[i].FindControl("txtKm62"); TextBox txtKm63 = (TextBox)this.GridView1.Rows[i].FindControl("txtKm63"); TextBox txtKm71 = (TextBox)this.GridView1.Rows[i].FindControl("txtKm71"); TextBox txtKm72 = (TextBox)this.GridView1.Rows[i].FindControl("txtKm72"); TextBox txtKm73 = (TextBox)this.GridView1.Rows[i].FindControl("txtKm73"); TextBox txtKm74 = (TextBox)this.GridView1.Rows[i].FindControl("txtKm74"); DropDownList ddlKm81 = (DropDownList)this.GridView1.Rows[i].FindControl("ddlKm81"); switch (this.Xm.ToLower()) { case "km61": if (!string.IsNullOrWhiteSpace(txtKm61.Text)) { bmk.km61 = decimal.Parse(txtKm61.Text); } break; case "km62": if (!string.IsNullOrWhiteSpace(txtKm62.Text)) { bmk.km62 = decimal.Parse(txtKm62.Text); } break; case "km63": if (!string.IsNullOrWhiteSpace(txtKm63.Text)) { bmk.km63 = decimal.Parse(txtKm63.Text); } break; case "km71": if (!string.IsNullOrWhiteSpace(txtKm71.Text)) { bmk.km71 = txtKm71.Text.Trim().ToUpper(); } break; case "km72": if (!string.IsNullOrWhiteSpace(txtKm72.Text)) { bmk.km72 = txtKm72.Text.Trim().ToUpper(); } break; case "km73": if (!string.IsNullOrWhiteSpace(txtKm73.Text)) { bmk.km73 = txtKm73.Text.Trim().ToUpper(); } break; case "km74": if (!string.IsNullOrWhiteSpace(txtKm74.Text)) { bmk.km74 = txtKm74.Text.Trim().ToUpper(); } break; case "km81": if (ddlKm81.SelectedIndex > 0) { bmk.km81 = ddlKm81.SelectedValue; } break; default: break; } bmk.Save(); } JsUtil.MessageBox(this, "操作完成!"); BindData(); // if (!string.IsNullOrEmpty(this.lblMsg.Text)) { // JsUtil.MessageBox(this,this.lblMsg.Text); } }