Search code examples
devexpressdevexpress-windows-uidevexpress-mvc

Devexpress End user Report Designer: Datasource binding is null when retrieve report from database


I am creating reporting server using asp.net mvc web api. I am retrieving data from web api retriving report using XRDesignForm object of devexpress. I am posting back report data to web api. what issue i am facing is, and if i use xtrareport obejct and bind datasource manually it work fine.i.e.

            XtraReport report = new XtraReport();
            report.DataSource = setupSummary.FillDataSet();

            report.DataMember = ((DataSet)report.DataSource).Tables[0].TableName;
            designForm.OpenReport(report);

            //designForm.Show();


            designForm.ShowDialog(this);

I can successfully mainuplate this report and can save into database,

But as shown in articles for ReportStorage, if i only retrieve report from database using report name from server, datasource is always null.i.e.

      XRDesignForm designForm = new XRDesignForm();

        string url = GetSelectedUrl();
        if (!string.IsNullOrEmpty(url))

            designForm.OpenReport(url);
        designForm.ShowDialog(this);

It seems that when saving dynamic report into database (as binary), It loss data source bindings. please help me for this. thanks


Solution

  • Aqdas, thank you very much.

    There is a similar error in the report layout,

    My solution is, after the layout again set DataSource

    XtraReport rep = null;
    
    rep = new rptReqVac();
    
    Stream layoutStream = null;
    
    layoutStream = mGetLoyoutStream(id);
    
    rep.LoadLayout(layoutStream);
    
    rep.DataSource = new dsREQPrintVac();
    
    reportDesigner.OpenReport(rep);
    

    Hope it will help someone :-)