彩票走势图

DevExpress XtraGrid网格控件数据关联:显示单元格相关数据

原创|其它|编辑:郝浩|2012-10-23 09:36:02.000|阅读 300 次

概述:本文通过一个具体事例来给大家演示,如何实现DevExpress显示与单元格相关的数据库数据。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

示例图如下:


我们点击第一列1994年下面的第三行单元格数据,就会显示出与这个单元格相关联的数据库数据:


代码如下:

C#

using DevExpress.XtraPivotGrid;

private void pivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) {
   // Create a new form.
   Form form = new Form();
   form.Text = "Records";
   // Place a DataGrid control on the form.
   DataGrid grid = new DataGrid();
   grid.Parent = form;
   grid.Dock = DockStyle.Fill;
   // Get the recrd set associated with the current cell and bind it to the grid.
   grid.DataSource = e.CreateDrillDownDataSource();
   form.Bounds = new Rectangle(100, 100, 500, 400);
   // Display the form.
   form.ShowDialog();
   form.Dispose();
}

VB

Imports DevExpress.XtraPivotGrid

Private Sub pivotGridControl1_CellDoubleClick(ByVal sender As Object, _
  ByVal e As PivotCellEventArgs) Handles pivotGridControl1.CellDoubleClick
   ' Create a new form.
   Dim form As Form = New Form
   form.Text = "Records"
   ' Place a DataGrid control on the form.
   Dim grid As DataGrid = New DataGrid
   grid.Parent = form
   grid.Dock = DockStyle.Fill
   ' Get the recrd set associated with the current cell and bind it to the grid.
   grid.DataSource = e.CreateDrillDownDataSource()
   form.Bounds = New Rectangle(100, 100, 500, 400)
   ' Display the form.
   form.ShowDialog()
   form.Dispose()
End Sub


标签:DevExpressgridcontrol

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@cahobeh.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP