protected void lbtnSave_Click(object sender, EventArgs e) { for (int i = 0; i < ASPxGridView1_Shape.VisibleRowCount; i++) { ASPxCheckBox chkD = ASPxGridView1_Shape.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1_Shape.Columns["D"], "chkD") as ASPxCheckBox; ASPxCheckBox chkH = ASPxGridView1_Shape.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1_Shape.Columns["H"], "chkH") as ASPxCheckBox; ASPxCheckBox chkL = ASPxGridView1_Shape.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1_Shape.Columns["L"], "chkL") as ASPxCheckBox; ASPxCheckBox chkW = ASPxGridView1_Shape.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1_Shape.Columns["W"], "chkW") as ASPxCheckBox; HiddenField hddCode = ASPxGridView1_Shape.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1_Shape.Columns["D"], "hddCode") as HiddenField; if (Utils.CStrDef(hddCode.Value) != "") { var itemPro = _ShapePropertyRepo.GetByCode(hddCode.Value); if (itemPro != null) { itemPro.D = Utils.CIntDef(chkD.Checked); itemPro.H = Utils.CIntDef(chkH.Checked); itemPro.L = Utils.CIntDef(chkL.Checked); itemPro.W = Utils.CIntDef(chkW.Checked); } _ShapePropertyRepo.Update(itemPro); } } Response.Redirect("hinh-dang.aspx"); }
protected void lbtnDelete_Click(object sender, EventArgs e) { List <object> fieldValues = ASPxGridView1_Shape.GetSelectedFieldValues(new string[] { "ID" }); foreach (var item in fieldValues) { _ShapeRepo.Remove(Utils.CIntDef(item)); } Response.Redirect("hinh-dang.aspx"); }
private void LoadList() { //List<ShapePro> list = new List<ShapePro>(); //var listShape = db.SHAPEs.ToList(); //for (int i = 0; i < listShape.Count; i++) //{ // ShapePro item = new ShapePro(); // item.ID = listShape[i].ID; // item.Code = listShape[i].CODE; // item.Name = listShape[i].NAME; // var itemPro = _ShapePropertyRepo.GetByCode(item.Code); // if (itemPro != null) // { // item.D = Utils.CIntDef(itemPro.D); // item.H = Utils.CIntDef(itemPro.H); // item.L = Utils.CIntDef(itemPro.L); // item.W = Utils.CIntDef(itemPro.W); // } // list.Add(item); //} var list = (from a in db.SHAPEs join b in db.SHAPE_PROPERTies on a.CODE equals b.SHAPE_CODE select new { a.ID , a.CODE , a.NAME , b.D , b.H , b.L , b.W }).ToList(); HttpContext.Current.Session["listShape"] = list; ASPxGridView1_Shape.DataSource = list; ASPxGridView1_Shape.DataBind(); }