我正在使用 MVC 4 使用 .NET 框架。我有一个控制器:
using DataProvider.Queries;
using DataProvider.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace ATSGlobalDashboard.Controllers
{
public partial class ATSNavigatorController : Controller
{
public virtual ActionResult Index(DataProvider.Models.GaugeAveragesViewModel model)
{
return View(model);
}
}
}
一个模型:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataProvider.Models
{
public class GaugeAveragesViewModel
{
public decimal? timetoresolutiontotalqtd { get; set; }
public int? backlogtotalcount { get; set; }
public double? AverageSatisfacationResult { get; set; }
}
}
然后我想将其用于我的视图/数据视觉效果中的值。我的部分观点是这样设置的:
@model DataProvider.Models.GaugeAveragesViewModel
@{
ViewBag.Title = "GlobalDashboardModal";
}
<div class="row">
<div id="satisfactionChartButton" class="large-3 large-offset-1 columns modalGaugeArea allGaugesSetup">
<div class="chartModalTitle">Customer Satisfaction</div>
<div id="customerSatisfactionGauge" class="gaugeContainer"></div>
<input id="customerSatisfactionGaugeValue" value="@Model.AverageSatisfacationResult"/>
<div class="chartModalDialog"></div>
<div id="satisfactionOverlay">
<div class="overlayChartTitle">Customer Satisfaction<br />
Chart
</div>
<img class="overlayImages" src="@Url.Content(Links.Content.img.wht_Desktop_Analytics_png)" />
<div class="overlayChartDialog">Click to View Chart</div>
</div>
</div>
</div>
我希望能够获取输入值并将其与其他一些资源一起使用,但是我得到一个空对象错误,@Model.AverageSatisfactionResult
因为无论如何快速测试这个,还是我在使用@Model razor 语法时留下了一步?