Report.RegisterData ( DataView , TabeName )

StarkStark Syria
edited 5:41PM in FastReport .NET
Hi have a good day

I think the Report didn't get the DataView with Filtered Rows

please try this code.
            DataTable datatable = new DataTable();

            // Add DataTable Columns 
            datatable.Columns.Add("ID");
            datatable.Columns.Add("Name");
            datatable.Columns.Add("Age");

            // Add DataTable Row
            datatable.Rows.Add("1", "Stark", "26");
            datatable.Rows.Add("2", "Sonya", "24");
            datatable.Rows.Add("3", "Kabal", "21");

            // Assign DataTable to Grid
            dataGridView1.DataSource = datatable;


            DataView dataview = new DataView(datatable);
            dataview.RowFilter = "ID = 1";


            // This will not work   ( NO Rows will Show ) 
            report1.RegisterData(dataview, "table1");

            // this Will Work       ( Work as expected ) 
            report1.RegisterData(dataview.ToTable(), "table1");

            report1.Show();

Comments

  • edited 5:41PM
    Hello,

    I've tested your example. It works well.
          DataTable datatable = new DataTable();
    
          // Add DataTable Columns
          datatable.Columns.Add("ID");
          datatable.Columns.Add("Name");
          datatable.Columns.Add("Age");
    
          // Add DataTable Row
          datatable.Rows.Add("1", "Stark", "26");
          datatable.Rows.Add("2", "Sonya", "24");
          datatable.Rows.Add("3", "Kabal", "21");
    
          DataView dataview = new DataView(datatable);
          dataview.RowFilter = "ID = 1";
    
    
          Report report1 = new Report();
          report1.Load(@"c:\1.frx");
          report1.RegisterData(dataview, "table1");
          report1.Show();
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.