RegisterData problem

edited July 2009 in FastReport .NET
hi,

i m using webreport and trying to register my business object like this;

protected void WebReport1_StartReport(object sender, EventArgs e)
{
//..
//Load Product List by Custom Business Objects
//
WebReport1.Report.Load(Server.MapPath("Products.frx"));
WebReport1.Report.RegisterData(ProductsList, "ProductsList");
WebReport1.Report.GetDataSource("ProductsList").Enabled = true;
((FastReport.DataBand)WebReport1.Report.FindObject("Data1")).DataSource = WebReport1.Report.GetDataSource("ProductsList");
((FastReport.DataBand)WebReport1.Report.FindObject("Data1")).DataSource.Enabled = true;
}

and html

<cc1:WebReport ID="WebReport1" runat="server" OnStartReport="WebReport1_StartReport" />

when i run this page, report is opening and there are 5 rows but all rows are blank.
but the products list has 5 rows with values.. and each list item has a custom object with public properties..

please help me..
thanks in advance..

Comments

  • edited 7:57PM
    Hello,

    When you register a business object this way, FastReport actually does nothing. You should go the designer, "Data|Choose Report Data" menu and check the necessary datasources/fileds. Try to replace

    WebReport1.Report.RegisterData(ProductsList, "ProductsList");

    with

    WebReport1.Report.RegisterData(ProductsList, "ProductsList", 3);

    where 3 is max. nesting level of your business object.
  • edited 7:57PM
    thanks for your reply alex,

    i tried also add an ObjectDataSource and chose it for DataSource but then, class public properties does not seem in report designer..

    i m trying to make your said but something is going wrong.. How can i solve this problem? i attached a sample web site for this issue..

    thanks for your helps..
  • edited 7:57PM
    The reason is simple: you've changed the datasource for the band, but didn't change the Text objects - Text2, Text4, Text6. They are still bound to old datasource - [ObjectDataSource1.Databound Col0]. You have to replace the text with something like this: [ProductList.ProductId]
  • edited 7:57PM
    hi alex,

    i changed my approach last night.. Now, i only using ObjectDataSource and not other code..
    My ObjectDataSource has public properties and a method for select. Select Method returns List<Products>
    and everything goes OK.

    Now i m looking for grouping. My product objects has a type property and i want to group report by type..
    i hope, i can do this quickly and easily..

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.