Click here to Skip to main content
15,850,265 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
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();
       }
Posted
Updated 4-Nov-18 13:06pm
v2
Comments
Wessam A Halim 16-Sep-18 17:38pm    
any feedback ?

"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?
 
Share this answer
 
Comments
Wessam A Halim 20-Sep-18 6:28am    
the form have 4 Radio buttons , checkbox and 2 datedime
i just need to filtering report data source it just code sample
report.DataSource = db.name.Where(x => x.IsActive == true)
the code work fine when change the report data source from entity to object , thank you all for help
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900