MVC - 视图将不会显示

时间:2015-08-24 21:03:21

标签: c# asp.net-mvc razor model-view-controller

我有一个视图,我无法在MVC中显示 这是我的控制器代码:

public class ReconController : Controller

{
    static List<Recon> _recon = new List<Recon>();
    public ActionResult Load()
    {    
        _recon = GetList();

        return View("Load",_recon);
    }

    private List<Recon> GetList()
    {
        List<Recon> _pvtrecon = new List<Recon>();
        string sSource = "Test";
        string sClinicID = "4";
        string sAccountName = "Checking";
        string sStatus = null;
        ReconUIDataLayer.Reconciliation reconlist = new     ReconUIDataLayer.Reconciliation();
        reconlist = ReconUIDataLayer.UIDataLayer.LoadRecon(sSource, sClinicID, sAccountName, ref sStatus);



        _pvtrecon = (from rows in reconlist.LineItems
                 select new Recon
                 {
                     ClinicID = rows.ClinicID.ToString(), //Convert row to int  
                     GLAcctCode = rows.GLAcctCode.ToString(),
                     LineSeq = Convert.ToInt32(rows.LineSeq.ToString()),
                     PrtlAmt = Convert.ToDouble(rows.PrtlAmt.ToString()),
                     PortalDocNum = rows.PrtlDocNum.ToString(),
                     PrtlFinRptDate = Convert.ToDateTime(rows.PrtlFinRptDate.ToString()),
                     PrtlTranDate = Convert.ToDateTime(rows.PrtlTranDate.ToString()),
                     PrtlUniqueID = rows.PrtlUniqueID.ToString(),
                     StmntAmt = Convert.ToDouble(rows.StmntAmt.ToString()),
                     StmntDocNum = rows.StmntDocNum.ToString(),
                     StmntEndDate = Convert.ToDateTime(rows.StmntEndDate.ToString()),
                     StmntTranDate = Convert.ToDateTime(rows.StmntTranDate.ToString()),

                 }).ToList();
        return _pvtrecon;
}

}

这是相关的视图

     @model IEnumerable<C1MvcWebApplication1.Models.Recon>
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <div>

    </div>
</body>
</html>

当我输入localhost / Recon / Load时,它会抛出404错误 当我查看视图的实际代码时,我在Line 1 Column 1 "Syntax error, '>' expected

中收到错误消息

我知道我现在只是尝试在视图中显示我的一个元素,但是我在控制器中列出了被调用类中的所有项目,以防出现滚动的语法问题。正在从我在References中附加的DLL调用ReconUIDataLayer.UIDataLayer.LoadRecon

1 个答案:

答案 0 :(得分:0)

据我所知,问题基本上是某种缓存问题。我关闭VS并重新打开解决方案,现在工作正常。