Devexpress报告查看器数据源过滤 [英] Devexpress report viewer datasource filtering

查看:171
本文介绍了Devexpress报告查看器数据源过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家;

我正在使用实体框架,sql数据库和devexpress在c#windows应用程序项目上工作我正在创建一个报告(devexpress报告)和打开查看器(ReportPrintTool)

i尝试从搜索表单查看报告并筛选视图是否有效查看但报告查看所有项目是否活跃且不活动theris no filtring



我尝试过:



Dear experts ;
i'm work on c# windows application project using entity framework , sql database and devexpress i'm create a report (devexpress report) and open viewer (ReportPrintTool)
i try to view the report from search form and filter if view active or not befor view but the report view all items active and disactive theris no filtring

What I have tried:

public partial class form name : Form
   {
       Entities.name db = new Entities.nameEntities();
       public form name()
       {
           InitializeComponent();
       }
       private void btnpreview_Click(object sender, EventArgs e)
       {
           rptname report = new rptname();
           //   this code not efficted
           if (rdioactive.Checked == true)
           {
               report.DataSource = db.name.Where(x => x.IsActive == true);
           }
           else if (rdiodisactive.Checked == true)
           {
               report.DataSource = db.name.Where(y => y.IsActive == false);
           }
           ReportPrintTool Ptool = new ReportPrintTool(report);
           Ptool.Report.CreateDocument();
           Ptool.ShowRibbonPreviewDialog();
       }

推荐答案

单选按钮通常是互斥的(假设它们是分组的正确地开始)。



为什么当你知道一个时显然可以推断两者时为什么要检查两者?



换句话说,为什么if else当else是你唯一的选择?
"Radio buttons" are usually "mutually exclusive" (assuming they were "grouped" properly to start with).

Why do you check "both" when obviously you can infer both when you know one?

In other words, why "if else" when "else" is your only option?


在将报表数据源从一个实体更改为另一个对象时,代码工作正常,谢谢大家的帮助
the code work fine when change the report data source from entity to object , thank you all for help


这篇关于Devexpress报告查看器数据源过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆