(三)

XtraGrid的功能与GridView的功能相似,使用方法也类似,不过他的功能更加令人惊讶,看看下面的效果

Code//生成此效果的解决方案:
// 1.从数据库去出两张表,
//后台
SqlConnManager.cs
public Class SqlConnManager
{
string _strConn = string.Empty;
SqlConnection _conn ;
public SqlConnManager(string strConn)
{
_strConn = strConn;
if (_conn == null)
_conn = GetSqlConn;
}
public System.Data.SqlClient.SqlConnection GetSqlConn
{
get
{
if (_conn == null||_conn.ConnectionString.Length==0)
_conn = new SqlConnection(strConn);
if (_conn.State == ConnectionState.Closed)
{
try
{
_conn.Open();
}
catch
{
return null;
}
}
return _conn;
}
set
{
_conn.Close();
}
}
}
TestXtraGrid.cs
SqlConnManager dbManager = new SqlConnManager(System.Configuration.ConfigurationManager.AppSettings["ConnenctionString"].ToString());
DataSet ds = new DataSet();
using(SqlDataAdapter adapter= new SqlDataAdapter ("select parent from Master",dbManager.GetSqlConn))
{
adapter.Fill(ds,"master");
}
//相同的方法过去子表的集合
//定义两个表之间的关系
System.Data.DataRelation relation = new System.Data.DataRelation("master-detail",ds.Tables[0].Columns["Master"],ds.Tables[1].Columns["Child"]);
ds.Relations.Add(relation);
//最后将此数据集绑定到XtraGrid

DevExpress.XtraGrid的使用(部分)的更多相关文章

  1. DevExpress.XtraGrid.view.gridview 属性说明

    本文摘自: http://www.cnblogs.com/-ShiL/archive/2012/06/08/ShiL201206081335.html (一)双击展开,收缩字表 ExpandedChi ...

  2. DevExpress.XtraGrid.GridControl 实现自定义tooltip

    DevExpress.XtraGrid.GridControl 控件默认的tooltip显示的每一个单元格的文本值,但是实际工作中会出现各种需求.我这里就有一个列是折扣率显示的值是0-1之间的两位小数 ...

  3. DevExpress.XtraGrid winform试用分享

    DevExpress.XtraGrid在winform里使用还挺麻烦,为了减少重复代码和代码复用,本人针对DevExpress.XtraGrid封装了一个Form的基类,其中涵盖了DevExpress ...

  4. DevExpress.XtraGrid.Views 设置指定行的背景颜色 .

    如需要将指定行的背景设置颜色,可参考以下示例 1.事件:CustomDrawCell 2.示例: private void gridView1_CustomDrawCell(object sender ...

  5. DevExpress.XtraGrid.Views.BandedGrid.BandedGridView

    使用的是DevExpress.XtraGrid.Views.BandedGrid.BandedGridView 类 没有在工具箱里找到对应控件 ,绕了一下,先创建一个gridcontrol ,然后gr ...

  6. DevExpress XtraGrid 数据导出导入Excel

    // <summary> /// 导出按钮 /// </summary> /// <param name="sender"></param ...

  7. 实现在DevExpress.XtraGrid.GridControl的列头绘制复选框以实现全选的功能

    首先新建一个Win Form测试项目,拖一个GridControl控件到窗体上. public partial class Form1 : Form { public Form1() { Initia ...

  8. DevExpress.XtraGrid.GridControl中数据源的绑定问题

    在利用DevExpress.XtraGrid.GridControl作为一个可编辑的表格控件时,在利用控件之前,先将一个初始化的DataTable对象作为GridControl的数据源进行绑定.可是在 ...

  9. DevExpress.XtraGrid

    DevExpress.XtraGrid控件使用 该控件类是一个表格控件,但是其具有很多方便而使用的功能,例如可以对记录进行分组,可以再记录的前面加上checkbox,可以将具有相同值的cell 进行合 ...

  10. DevExpress.XtraGrid 【转】

    http://www.cnblogs.com/zeroone/p/4574539.html DevExpress.XtraGrid控件使用 该控件类是一个表格控件,但是其具有很多方便而使用的功能,例如 ...

随机推荐

  1. PHP中 对象自动调用的方法:__set()、__get()、__tostring()

    总结: (1)__get($property_name):获取私有属性$name值时,此对象会自动调用该方法,将属性name值传给参数$property_name,通过这个方法的内部 执行,返回我们传 ...

  2. busybox filesystem ts_config: No such file or directory

    /******************************************************************** * busybox filesystem ts_config ...

  3. erlang 线上分析工具集锦

    1.Recon-Erlang线上系统诊断工具(引自): Erlang系统素以稳定可靠闻名,但是它也是c实现的,也是要管理比如内存,锁等等复杂的事情,也会出现Crash,而且crash的时候大部分原因是 ...

  4. 业界最具影响力MySQL精品文章荟萃(300篇)

    MySQL是一种关联数据库管理系统,SQL语言是用于访问数据库的最常用标准化语言.本文档收集的资料有MySQL数据库备份与恢复,配置,解决方案等,供大家方便统一阅读. 博客专题 1     MySQL ...

  5. Android-给另一个Activity传递HashMap

    I have a HashMap which I would pass to another Activity class. I simply use this code: Intent intent ...

  6. 【转】MegaSAS RAID卡 BBU Learn Cycle周期的影响

    http://ju.outofmemory.cn/entry/140 背景 最近遇到有些带MegaSAS RAID卡的服务器,在业务高峰时突然IO负载飚升得很高,IO性能急剧下降,查了日志及各种设置最 ...

  7. HDU5045-Contest(状压dp)

    题意: 有n个学生,m道题,给出每个同学解出m个问题的概率,在解题过程中每个学生的解题数的差不大于1,求最大能解出题目数的期望 分析: n很小,知道用状压,但是比赛没做出来(脑子太死了,有一个限制条件 ...

  8. hadoop 权限错误 Permission denied: user=root, access=WRITE, inode="/":hdfs:super

    关于不能执行Hadoop命令 并报权限问题执行错误1.Permission denied: user=root, access=WRITE, inode="/":hdfs:supe ...

  9. 【暑假】[实用数据结构]UVAlive 3135 Argus

    UVAlive 3135 Argus Argus Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %l ...

  10. Min Edit Distance

    Min Edit Distance ----两字符串之间的最小距离 PPT原稿参见Stanford:http://www.stanford.edu/class/cs124/lec/med.pdf Ti ...