错误MVC contribgrid有关标识符除外 [英] Error in MVC contribgrid regarding identifier excepted

查看:179
本文介绍了错误MVC contribgrid有关标识符除外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MVC 2和MVC contribgrid

我收到错误为换行是不变的,标识预期,excepeted这是我的编码

 <表格的cellpadding =0CELLSPACING =0WIDTH =100%>
    <%,如果(计算机[CustomerInfoList] = NULL&放大器;!及((名单< SaasModel.CustomerInfo方式>)计算机[CustomerInfoList])计数()0)
       {
    %GT;
    &所述; TR>
        &所述; TD>
            <%Html.Grid((名单< SaasModel.CustomerInfo>)计算机[CustomerInfoList])。列(
        列=>
            {
                column.For(COL => col.CustomerName).Named(姓名);
                column.For(COL => col.CompanyName).Named(公司名称);
                column.For(COL => col.Description).Named(说明);
                column.For(COL => col.CustomerRevenue).Named(CustomerRevenue);
                column.For(COL => col.NoOfEmployees).Named(NoOfEmployees);
                column.For(COL => col.Vertical).Named(垂直);
                column.For(COL => col.SaleExecutive).Named(SaleExecutive);
            }).Attributes(id=>\"datalist\",@class=>\"silicaGrid\",cellspacing=>\"1\",cellpadding=>\"0\").Render();
            %GT;
        < / TD>
    < / TR>
    <%}%GT;
< /表>

它显示的错误在这个引用文字部分: **<%**如果(计算机[CustomerInfoList] = NULL&放大器;及((名单< SaasModel.CustomerInfo>)


解决方案

 <%@页标题=LANGUAGE =C#的MasterPageFile =〜/查看/共享/网站的.master继承=CelloSaaS.View.CelloViewPage%GT;< ASP:内容ID =内容1ContentPlaceHolderID =日程地址搜索Maincontent=服务器>
< H2>
    CustomerInfoList< / H>
< A HREF =CustomerInfo.aspx称号=添加>
    < IMG SRC =<%= this.ResolveClientUrl ../../ App_Themes文件/ CelloSkin / BTN-add.gif)%>中ALT =添加/>
&所述; / A>
<表格的cellpadding =0CELLSPACING =0WIDTH =100%>
    <%,如果(计算机[CustomerInfoList] = NULL&放大器;!及((名单< SaasModel.CustomerInfo方式>)计算机[CustomerInfoList])计数()0)
       {
    %GT;
    &所述; TR>
        &所述; TD>
            <%Html.Grid((名单< SaasModel.CustomerInfo>)计算机[CustomerInfoList])。列(
        列=>
            {
                column.For(COL => col.CustomerName).Named(姓名);
                column.For(COL => col.CompanyName).Named(公司名称);
                column.For(COL => col.Description).Named(说明);
                column.For(COL => col.CustomerRevenue).Named(CustomerRevenue);
                column.For(COL => col.NoOfEmployees).Named(NoOfEmployees);
                column.For(COL => col.Vertical).Named(垂直);
                column.For(COL => col.SaleExecutive).Named(SaleExecutive);
            }).Attributes(id=>\"datalist\",@class=>\"silicaGrid\",cellspacing=>\"1\",cellpadding=>\"0\").Render();
            %GT;
        < / TD>
    < / TR>
    <%}%GT;
< /表>

看我的观点,说在那里我做了错误...

i am using mvc 2 and mvc contribgrid

I am Getting error as "Newline is constant","identifier expected",";excepeted" here is my coding

<table cellpadding="0" cellspacing="0" width="100%">
    <% if (ViewData["CustomerInfoList"] !=null && ((List<SaasModel.CustomerInfo>)ViewData["CustomerInfoList"]).Count()>0)
       {
    %>
    <tr>
        <td>
            <%  Html.Grid((List<SaasModel.CustomerInfo>)ViewData["CustomerInfoList"]).Columns(
        column=>
            {
                column.For(col=>col.CustomerName).Named("Name");
                column.For(col=>col.CompanyName).Named("CompanyName");
                column.For(col=>col.Description).Named("Description");
                column.For(col=>col.CustomerRevenue).Named("CustomerRevenue");
                column.For(col=>col.NoOfEmployees).Named("NoOfEmployees");
                column.For(col=>col.Vertical).Named("Vertical");
                column.For(col=>col.SaleExecutive).Named("SaleExecutive");
            }).Attributes(id=>"datalist",@class=>"silicaGrid",cellspacing=>"1",cellpadding=>"0").Render();
            %>
        </td>
    </tr>
    <%}%>
</table>

it shows error in this Blockquotes part:**<%** if (ViewData["CustomerInfoList"] !=null && ((List<SaasModel.CustomerInfo>)

解决方案

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="CelloSaaS.View.CelloViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h2>
    CustomerInfoList</h2>
<a href="CustomerInfo.aspx" title="Add">
    <img src="<%=this.ResolveClientUrl../../App_Themes/CelloSkin/btn-add.gif")%>" alt="Add" />
</a>
<table cellpadding="0" cellspacing="0" width="100%">
    <% if (ViewData["CustomerInfoList"] !=null && ((List<SaasModel.CustomerInfo>)ViewData["CustomerInfoList"]).Count()>0)
       {
    %>
    <tr>
        <td>
            <%  Html.Grid((List<SaasModel.CustomerInfo>)ViewData["CustomerInfoList"]).Columns(
        column=>
            {
                column.For(col=>col.CustomerName).Named("Name");
                column.For(col=>col.CompanyName).Named("CompanyName");
                column.For(col=>col.Description).Named("Description");
                column.For(col=>col.CustomerRevenue).Named("CustomerRevenue");
                column.For(col=>col.NoOfEmployees).Named("NoOfEmployees");
                column.For(col=>col.Vertical).Named("Vertical");
                column.For(col=>col.SaleExecutive).Named("SaleExecutive");
            }).Attributes(id=>"datalist",@class=>"silicaGrid",cellspacing=>"1",cellpadding=>"0").Render();
            %>
        </td>
    </tr>
    <%}%>
</table>

see my view and say where i have done mistake...

这篇关于错误MVC contribgrid有关标识符除外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆