一个AspxGridView包含另一个AspxGridView实现主从数据绑定
2013-04-19 15:08
555 查看
实现对象:产品(Products)、产品详情(ProductsDetails)、产品类型(Categorys)
数据源:EntityDataSource
第一步:产品的AspxGridView用EntityDataSource绑定所有数据,分别启用Insert,Delete,Update(这些功能的实现就在此省略了)
gvProducts的EntityDataSoure,注意一定要包含属性:Include,这个属性一定要绑定产品详情的实体类,即:Include="ProductsDetails"
显示代码
数据源:EntityDataSource
第一步:产品的AspxGridView用EntityDataSource绑定所有数据,分别启用Insert,Delete,Update(这些功能的实现就在此省略了)
gvProducts的EntityDataSoure,注意一定要包含属性:Include,这个属性一定要绑定产品详情的实体类,即:Include="ProductsDetails"
显示代码
protected void gvProductsDetail_DataBinding(object sender, EventArgs e) { ASPxGridView gvDetail = sender as ASPxGridView; if (gvDetail != null) { int i = Convert.ToInt32(gvDetail.GetMasterRowKeyValue()); ProductsDetails detail = db.ProductsDetails.First(pd => pd.PId == i); List<ProductsDetails> list = new List<ProductsDetails>(); list.Add(detail); gvDetail.DataSource = list; gvDetail.KeyFieldName = "PId"; } }
相关文章推荐
- 设计一个学生类,其中包含学号、姓名、成绩等数据成员,创建学生对象并且倒入到文件file.txt,然后由文件读取到另一个学生对象并输出,试编程实现。
- 我的ASPxGridView控件的数据是在后台绑定的,但是实现不了筛选和分页的功能,只能显示一页的数据?
- MySql中把一个表的数据插入到另一个表中的实现代码
- sqlserver 利用数据库脚本实现取一个表中的数据插入到另一个表
- 为AspxGridView绑定数据
- mysql 复制一个表中数据到另一个表实现方法
- [转] 用ROW_NUMBER()实现取指定行的数据 和从一个表中向另一个表中插入数据并实现某字段每行递增
- 1005实现一个线程从共享的缓冲区中读数据,另一个线程向共享的缓冲区中写数据
- Castle ActiveRecord 在GridView数据绑定时候的一个问题
- Dev控件系列之ASPXGridview控件自主绑定数据
- 手动绑定数据到GridView并实现编辑,删除,取消···
- 手动绑定数据到GridView并实现编辑,删除,取消···
- 利用 JavaScript 数据绑定实现一个简单的 MVVM 库
- (DevExpress2011控件教程)ASPxGridView 范例4 :ASPxGridView 行选择、多表头设计、数据导出、主表细表等功能实现
- ASPxGridview总结(ASPxGridView的增,删,改,查,数据绑定,外观显示,功能设定,分页)
- Asp.net使用jQuery实现Gridview, Repeater异步绑定数据
- dblink实现一个数据库用户只能查另一个库用户的数据
- GridView 动态添加模板列并绑定数据 实现从外部直接传入控件 和 绑定字段参数
- 使用 AJAX,局部刷新 GridView 进行数据绑定的简单实现
- 手动绑定数据到GridView并实现编辑,删除,取消···