0

Hello i am trying to make a report with crystal reports and i want to add a list of my object, i made an object with inherited DataRow, then i do a list of DataRows but i cannot convert it, how i can handle it?

 pdta.Columns.Remove("client_id");
 pdta.Columns.Remove("id1");
 pdta.Columns.Remove("units");
 pdta.Columns.Remove("provider");
 pdta.Columns.Remove("sub_categorie");
 pdta.Columns.Remove("id_invoice");
 pdta.Columns.Remove("id_product");
 pdta.Columns.Remove("invoice_date");       
 pdta.Columns.Remove("collection_method");
 pdta.DefaultView.AllowNew = false;
 pdta.DefaultView.AllowEdit = false;
 pdta.DefaultView.AllowDelete = false;
 InvoiceProductsDataGrid.ItemsSource = pdta.DefaultView;
 try
    {
       DataView dt = pdta.DefaultView;
       DataTable dta = pdta.DefaultView.ToTable();
       List<InvoiceProducts> llista = dta.AsEnumerable().ToList();
    }
    catch(Exception ex)
    {
            await DialogService.ShowMessage("Error",ex.Message);
    }
Dokman
  • 43
  • 6
  • ` then i do a list of DataRows but i cannot convert it,` what does this mean.. are you getting errors, can you tell us what is going on.. what happens when you use the debugger and step through the code.. ? is the data being bound properly when you assign the ItemSource..? please provide more relevant details. – MethodMan May 31 '17 at 14:15
  • `dt.AsEnumerable().Cast().ToList();` will get you your list of InvoiceProducts. Are there any properties of the derived class that need to be set for each DataRow? – Blake Thingstad May 31 '17 at 14:24
  • basically if i want to make a Crystal Reports like you know, i have to add or a datset or a list of an object to make it working, so i want to add only certain records from a DataView using a DataGrid that i have binded in a DefaultView to eliminate certain columns that i don't need, and i need to put a list of objects into the CrystalReports and i don't know what i have to put in the crystal reports to connect it, so i've made an object for this, inherited from DataRow i don't know if it's corret, and thanks for answering – Dokman May 31 '17 at 17:31

0 Answers0