webReport1.Report.RegisterData(myDataSet) Does Not Work

I am evaluating FastReport to see if it can be used in my asp.net application.

I am trying to report the data from the object on my web page. Here is my steps:

1. Add a WebReport component on my page.
2. Click the "smart tip" and select "Design Report ...". It opens the Designer with a blank report.
3. Connect a DataBase Table "ProductCategories" on Designer.
4. Add a TextObject, Text1, on Data band.
5. Edit Text1 as [ProductCategories.Name]. (Name is one of column in the Table).
6. Run the Preview, and get the correct result: The Text1 shows the first Cagegory Name.
7. Save the FRX file to my asp.net application's App_Data folder, and select this file as the WebReport component's ReportFile.
8. Add the following code on my asp.net page:
protected void WebReport1_StartReport(object sender, EventArgs e)
{
List<ProductCategory> pList = ProductCategory.RetrieveAll();
WebReport1.Report.RegisterData(pList, "ReportList");
WebReport1.Report.GetDataSource("ReportList").Enabled = true;
}
Where, ProductCategory.RetrieveAll() is my from my business object:

public partial class ProductCategory
{
public static List<ProductCategory> RetrieveAll()
{
///Test for FastReport to show the Category with ID=31.
ProductsDataContext db = new ProductsDataContext();
var categories = from c in db.ProductCategories
where c.ID.Equals(31)
select c;
return categories.ToList();
}
}

Here I am going to show the Category Name with ID=31. However, the code seems not working. The result still showing the the FIRST Cagegory Name (which ID=1).

What wrong did I do?

Thanks,

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.