Ser*_*rev 0 c# reporting devexpress
我尝试从XtraReport的行(在哪里单击)获取所有值。
我不知道为什么,但是xrTableRow1_PreviewClick和xrTable1_PreviewClick不起作用。
仅适用于xrTableCell4_PreviewClick。通过“ e.Brick.Text”,我只能在单元格中获得价值。
private void xrTableCell1_PreviewClick(object sender, PreviewMouseEventArgs e)
{
var tmp = e.Brick.Text;
}
Run Code Online (Sandbox Code Playgroud)
如果我尝试:
GetCurrentRow()
Run Code Online (Sandbox Code Playgroud)
它仅给出第一行。这不是我所需要的。)
如何从点击所在的行中获取所有值?或者如何获得点击所在的行索引?
我的报告在设计器中看起来像:

提前致谢!
没有简单的方法使用砖方法访问相应的数据行。生成所有必需的砖块后,报告不再引用数据源。换句话说,砖头现在确实了解基础数据。它们仅包含文本,图像或其他控件。
完成此任务的最简单方法是处理XRControl的BeforePrint事件,并将相应的数据对象(DataRowView或自定义对象)传递到XRControl的Tag属性:
private void xrLabel_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
// Obtain the current label.
XRLabel label = (XRLabel)sender;
//Obtain the parent Report
XtraReportBase parentReport = label.Report;
//Get the data object
object currentData = parentReport.GetCurrentRow();
//Pass this object to Tag
label.Tag = currentData;
}
Run Code Online (Sandbox Code Playgroud)
之后,可以通过PreviewClick事件处理程序中的e.Brick.Value属性访问数据对象。
| 归档时间: |
|
| 查看次数: |
1768 次 |
| 最近记录: |