Exception while rendering report ASP.Net core



  • Hi Team,

    Following is the code I have written to render the report. I have a function that returns json string which needs to be generated as a report. But I am facing exception on RenderAsync method. The json string is returned from MongoDB. Anything I am missing?

    [MiddlewareFilter(typeof(JsReportPipeline))]
    		public IActionResult JsReportView()
    		{
    			HttpContext.JsReportFeature().Recipe(Recipe.PhantomPdf);
    			var viewModel = new dynamicModel();
    			var jsonString = viewModel.RetrieveDynamicCollection("1");
    			JsReportMVCService.RenderAsync("Report", jsonString);
    			return View();
    		}


  • Please try to start with this example.
    https://github.com/jsreport/jsreport-dotnet-example-webapp



  • Hi @jan_blaha,

    Thanks for pointing me to the examples. However, I had a question regarding designing reports. As per examples given, I see jsreport required a model defined upfront. Is it possible to design the report without any model defined? As I have a dynamic model, I will only have json string as output from DB. Or if you can suggest any better way.



  • It is more a razor/asp.net question than jsreport question.
    I am not using razor so not sure.

    I would guess you parse the json using json.net into a dynamic object and pass it as dynamic model to the view.
    However, as I said, not an expert here.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.