Skip to main content
A newer version of this page is available. .

How to: Bind ASP.NET MVC Dashboard to an Object Data Source using a Custom Fill Service

  • 5 minutes to read

This example shows how to bind the ASP.NET MVC Dashboard extension to the Object Data Source and supply it with data using a custom fill service by implementing a IObjectDataSourceCustomFillService interface.

You can use the custom fill service (IObjectDataSourceCustomFillService to get access to the DashboardObjectDataSource data (data fields used in a dashboard, the filter expression, parameters and their actual values) and use it in the current data query.

The IObjectDataSourceCustomFillService is executed if you use typeof() to specify the ObjectDataSource.DataSource property.

In this example, the ObjectDataSourceFillParameters.DataFields parameter is used to load data only for required fields.

using System.Web.Mvc;

namespace MVCxDashboard_CustomFillService.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }
    }
}