MVC Dashboard

Сonversation on different topics
Post Reply
NegiFixzone
Posts: 1
Joined: Thu Feb 21, 2019 5:07 pm

MVC Dashboard

Post by NegiFixzone » Thu Feb 21, 2019 5:36 pm

Hi All, I have written a sample project in MVC for design and show Dashboards, which is working fine, now I am trying to change it a little bit.
there is a table for each dashboard that contains a thumbnail picture and name of it, I want to by clicking on each table show the dashboard,(like the demo site but in MVC). this is the function for Onclick event of tables.

Code: Select all

function loadReportToViewer(reportName) {
    $.ajax({
        async: false,
        url: '/ViewDashboard/GetReport',
        data: JSON.stringify({ id: reportName }),
        dataType: 'json',
        contentType: 'application/json; charset=utf-8'
    }).done(function() {
        alert('Added');
    });
}
the problem is , it's coming to getReport action but it wont show the dashboard. Also in my View I had added StiMvcViewer settings.
in the old way, these 3 actions called: ViewDashboard, GetReport, ViewerEvent.
If you have done something similar, please let me know.
Thanks.
Lech Kulikowski
Posts: 1515
Joined: Tue Mar 20, 2018 5:34 am

Re: MVC Dashboard

Post by Lech Kulikowski » Fri Feb 22, 2019 12:57 pm

Hello,

You can use URL parameters for dashboard loading:

Code: Select all

url: '/ViewDashboard/GetReport?name=DashboardName',
Controller:

Code: Select all

public ActionResult GetReport(string name)
{
  var report = new StiReport();
  report.Load(Server.MapPath($"~/Dashboards/{name}.mrt"));

  return StiMvcViewer.GetReportResult(report);
}
Also, please check the following sample:
https://github.com/stimulsoft/Samples-D ... MVC-CSharp

Thank you.
Post Reply