Custom Reporting ASP.NET MVC

1 posts, 0 answers
  1. Luis Ismael
    Luis Ismael avatar
    14 posts
    Member since:
    Nov 2014

    Posted 19 Feb 2018 Link to this post

    There is a way to customize the report with LINQ?

    I did this but I made it work

    public class ReportController : Controller
            // GET: Report
            public ActionResult Index()
                Uri uri = HttpContext.Request.Url;
                var changeReport = new ReportController().Identification(1, uri);
                return View(new ReportModel() { TheReport = changeReport});


    //This is what I do

    DBContext db = new DBContext();

                var data = db.Patient.FirstOrDefault();
                var name = data.FirstName + " " + data.LastName;

    var txtName= ((Telerik.Reporting.TextBox)report.Items.Find("txtName", true)[0]);
                    txtName.Value = !string.IsNullOrEmpty(name) ? name.Trim() : empty;

    // in webforms I did it this way and it worked

    var instanceReportSource = new Telerik.Reporting.InstanceReportSource {ReportDocument = report};
                    ReportViewer.ReportSource = instanceReportSource;

    Does anyone know how to do this in mvc?



Back to Top