asp.net-mvcasp.net-mvc-2mvccontrib-grid

Error in MVC contribgrid regarding identifier excepted


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>)


Solution

  • <%@ 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...