protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { int i = ASPxGridView1.FindVisibleIndexByKeyValue(e.Keys[ASPxGridView1.KeyFieldName]); Control c = ASPxGridView1.FindDetailRowTemplateControl(i, "ASPxGridView2"); e.Cancel = true; ds = (DataSet)Session["DataSet"]; ds.Tables[0].Rows.Remove(ds.Tables[0].Rows.Find(e.Keys[ASPxGridView1.KeyFieldName])); }
protected void ASPxGridView2_BeforePerformDataSelect(object sender, EventArgs e) { using (var conexion = new DataModelFE()) { long idProducto = long.Parse((sender as ASPxGridView).GetMasterRowKeyValue().ToString()); ASPxGridView detailGird = ASPxGridView1.FindDetailRowTemplateControl(ASPxGridView1.FocusedRowIndex, "ASPxGridView2") as ASPxGridView; //detailGird.DataSource = conexion.ProductoImpuesto.Where(x => x.idProducto == idProducto).ToList(); // detailGird.DataBind(); } }
protected string GetDetailRowValue(string id) { var index = ASPxGridView1.FindVisibleIndexByKeyValue(id); var detail = ASPxGridView1.FindDetailRowTemplateControl(index, "ASPxGridViewDetail") as ASPxGridView; if (detail != null) { return(detail.FindVisibleIndexByKeyValue(id).ToString()); } return(string.Empty); }
protected string GetDetailRenderedControlID(string keyvalue, string controlId) { if (string.IsNullOrEmpty(controlId)) { return(string.Empty); } var index = ASPxGridView1.FindVisibleIndexByKeyValue(keyvalue); var detail = ASPxGridView1.FindDetailRowTemplateControl(index, "ASPxGridViewDetail") as ASPxGridView; var control = detail.FindEditFormTemplateControl(controlId); return(control.ClientID); }
protected void ASPxGridView1_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Detail) { ASPxGridView grdetail = ASPxGridView1.FindDetailRowTemplateControl(e.VisibleIndex, "GridDetail") as ASPxGridView; grdetail.DataSource = new[] { new{ Key = "1", PRName = "Sản xuất 1", PName = "Sản phẩm 1" }, new{ Key = "2", PRName = "Sản xuất 1", PName = "Sản phẩm 2" }, new{ Key = "3", PRName = "Sản xuất 2", PName = "Sản phẩm 1" }, new{ Key = "4", PRName = "Sản xuất 2", PName = "Sản phẩm 2" }, new{ Key = "5", PRName = "Sản xuất 3", PName = "Sản phẩm 3" }, }; grdetail.KeyFieldName = "Key"; grdetail.DataBind(); } }
protected void ASPxGridView2_DetailRowExpandedChanged(object sender, ASPxGridViewDetailRowEventArgs e) { using (var conexion = new DataModelFE()) { long idProducto = long.Parse(ASPxGridView1.GetRowValues(e.VisibleIndex, "id").ToString()); ASPxGridView detailGird = ASPxGridView1.FindDetailRowTemplateControl(e.VisibleIndex, "ASPxGridView2") as ASPxGridView; if (detailGird != null) { detailGird.DataSource = conexion.ProductoImpuesto.Where(x => x.idProducto == idProducto).ToList(); detailGird.DataBind(); } } }
protected void ASPxGridView1_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableRowEventArgs e) { if (e.RowType == DevExpress.Web.ASPxGridView.GridViewRowType.Detail) { ASPxGridView grdetail = ASPxGridView1.FindDetailRowTemplateControl(e.VisibleIndex, "GridDetail") as ASPxGridView; grdetail.DataSource = new[] { new{ ID = "SP001", Name = "Sản phẩm 1", Unit = "Hộp", Quantity = "10", ShortestTime = "25/08/2013", Time = "25/08/2013", Priority = "1", Note = "Cần gấp" }, new{ ID = "SP002", Name = "Sản phẩm 2", Unit = "Thùng", Quantity = "2", ShortestTime = "25/08/2013", Time = "25/08/2013", Priority = "2", Note = "Cần gấp" }, new{ ID = "SP003", Name = "Sản phẩm 3", Unit = "Thùng", Quantity = "4", ShortestTime = "25/08/2013", Time = "25/08/2013", Priority = "3", Note = "" }, new{ ID = "SP004", Name = "Sản phẩm 4", Unit = "Hộp", Quantity = "20", ShortestTime = "25/08/2013", Time = "25/08/2013", Priority = "4", Note = "Dự trữ" }, new{ ID = "SP005", Name = "Sản phẩm 5", Unit = "Hộp", Quantity = "100", ShortestTime = "25/08/2013", Time = "25/08/2013", Priority = "5", Note = "" } }; grdetail.KeyFieldName = "ID"; grdetail.DataBind(); } }