This is a migrated thread and some comments may be shown as answers.

Custom Reporting ASP.NET MVC

0 Answers 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Luis Ismael
Top achievements
Rank 1
Luis Ismael asked on 19 Feb 2018, 08:20 PM

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});
        }

@(Html.TelerikReporting().ReportViewer()
            .Id("reportViewer1")
            .ServiceUrl(Url.Content("~/api/reports"))
            .TemplateUrl(Url.Content("~/Content/ReportViewer/templates/telerikReportViewerTemplate.html"))
            .ReportSource(Model.TheReport)
            .ViewMode(ViewMode.Interactive)
            .ScaleMode(ScaleMode.Specific)
            .Scale(1.0)
            .PersistSession(false)
            .PrintMode(PrintMode.AutoSelect)
            .EnableAccessibility(false)
            .Deferred()
    )

//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 asp.net webforms I did it this way and it worked

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

Does anyone know how to do this in asp.net mvc?

 

 

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Luis Ismael
Top achievements
Rank 1
Share this question
or