mapr
mapr

Reputation: 119

How to connect data to a devexpress blazor report?

I have a .net core project which cotains a report viewer on a blazor page and I'm trying to bind it to a data source without success

<div style="width: 100%; margin: auto;">
    <DxDocumentViewer ReportUrl="PatientPending" Height="800px" Width="100%" @ref="Report">
        <DxDocumentViewerTabPanelSettings Width="180" />
    </DxDocumentViewer>
</div>

This is my data source

[DisplayName("PatientPending")]
    [HighlightedClass]
    public class PatientPendingDataSource {
        
        public PatientPendingDataSource() {
            
        }

        [HighlightedMember]
        public IEnumerable<Patient> GetData() {
            return new List<Patient> {
                new Patient {
                    Id = 5
                },
                new Patient {
                    Id = 6
                },
            };

        }
    }

The datasource of this report is typeof(PatientPendingDataSource) and the datamember to "GetData" I've set a breakpoint on the GetData method but it's never reached, what am I doing wrong?

Upvotes: 0

Views: 716

Answers (1)

e1ecringe
e1ecringe

Reputation: 146

The Document Viewer in Blazor apps obtain reports from report storage. Thus, you need to locate this report into storage and specify only the ReportUrl property. When binding this report to IEnumerable<Patient> make sure that you've checked the following entries in the data source wizard and then your method should be called at runtime:

1) Select a Member to Bind

2) enter image description here

Upvotes: 0

Related Questions