本文介绍了MVC4视图中的错误(Razor)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! @model List< habg.Models.OtherServices> @using(Html.BeginUmbracoForm< habg.pocos.OtherservicesSurfaceController>(otherservices)) { @ Html.AntiForgeryToken() if(Model!) = null) { @if(模型!= null&& Model.Count> 0) { int j = 0; foreach(var.in Model.FindAll(i => i.TourType == 1).ToList()) { if(j == 0) { < h4>有组织的旅游< / h4> < ul class =os_list> } < li> @ Html.HiddenFor(a => a [j] .TourServiceId) @ Html.HiddenFor(a => a [j] .BookingId)< div class = imgHolder>< img src =@ System.Web.Configuration.WebConfigurationManager.AppSettings [AdminProductImage_VirtualPath] @ i.ImagePath/>< / div><! - imgHolder - > < div class =imgInfo> @ i.TourService_Title < p> @ i.TourService_Description< / p> 价格:@ i.Price < / div><! - imgInfo - > < div class =os_form> @ i.StartDate至@ i.EndDate < span>< label>否。 of person< / label> @ Html.TextBoxFor(a => a [j] .PersonCnt,new {@class =personNo topInsideShadow numericOnly,@ maxlength =2})< / span> < span>< label>检查以利用< / label> @ Html.CheckBoxFor(a => a [j] .IsSelected)< / span> < / div><! - os-form - > < / li> j = j + 1; } } < / ul> < input type =submitvalue =submitclass =submitBtn/> } } 我得到的错误 - using块缺少一个结束}字符。确保此块中的所有{字符都有匹配的}字符,并且没有任何}字符被解释为标记。解决方案 @model List<habg.Models.OtherServices>@using (Html.BeginUmbracoForm<habg.pocos.OtherservicesSurfaceController>("otherservices")){ @Html.AntiForgeryToken() if (Model!= null) { @if (Model != null && Model.Count > 0) { int j=0; foreach(var i in Model.FindAll(i=>i.TourType == 1).ToList()) { if(j==0) { <h4>Organised Tour</h4> <ul class="os_list"> } <li> @Html.HiddenFor(a => a[j].TourServiceId) @Html.HiddenFor(a=>a[j].BookingId) <div class="imgHolder"><img src="@System.Web.Configuration.WebConfigurationManager.AppSettings["AdminProductImage_VirtualPath"]@i.ImagePath" /></div><!--imgHolder--> <div class="imgInfo"> @i.TourService_Title <p>@i.TourService_Description</p> Price : @i.Price </div><!--imgInfo--> <div class="os_form"> @i.StartDate to @i.EndDate <span><label>No. of person</label>@Html.TextBoxFor(a => a[j].PersonCnt, new { @class = "personNo topInsideShadow numericOnly", @maxlength="2" })</span> <span><label>Check to avail</label>@Html.CheckBoxFor(a=> a[j].IsSelected)</span> </div><!--os-form--> </li> j = j + 1; } } </ul> <input type="submit" value="submit" class="submitBtn" /> }}The error I am getting -The using block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup. 解决方案 这篇关于MVC4视图中的错误(Razor)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-15 11:04