首先我想向大家道歉,因为我知道这个问题已经被问了很多次。但我本身对MVC或.NET或Lambda表达式本身知之甚少。我工作的一个小项目,我被困在Lambda表达式如下错误 MVC4中的Lambda表达式错误
编辑 下面是控制器代码
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVC4Trial.Models;
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
namespace MVC4Trial.Controllers
{
public partial class CallTrackController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Remote_Data()
{
return View("AjaxBinding");
}
public ActionResult vwCallDetails([DataSourceRequest] DataSourceRequest request)
{
return Json(GetCallDetailsFn().ToDataSourceResult(request));
}
private static IEnumerable<CallDetails> GetCallDetailsFn()
{
var callData = new CallTrackClassDataContext();
return callData.CallDetails.Select(calldetail => new CallDetails
{
CCCID = calldetail.CCCID,
Mp3_Url = calldetail.Mp3_Url,
Index = calldetail.Index,
Target_Number = calldetail.Target_Number,
Duration = calldetail.Duration,
LocalTime = calldetail.LocalTime,
Site_Name___Address = calldetail.Site_Name___Address,
Ad_Source_Name = calldetail.Ad_Source_Name,
Tracking_Number = calldetail.Tracking_Number,
Caller_Number = calldetail.Caller_Number,
Available_Feature = calldetail.Available_Feature
});
}
}
}
我想了解如何解决这个错误。我在这里错过了什么?我是否需要对模型/视图/任何其他文件进行任何更改?感谢您的阅读和帮助。
一个截图很不错,但你可以发布代码的文本,以便其他人不需要重新键入它? – PinnyM 2013-02-14 21:22:15
“持续时间”行上的错误是什么?我注意到其他错误会导致linq错误。 – Andorbal 2013-02-14 21:22:38
我注意到'持续时间'是加下划线的 - 这个属性有什么特别的吗? – 2013-02-14 21:22:48