简体   繁体   中英

Illegal Character and missing ] after element list error

I am using Servicestack to send a custom Object List to Razor View page but i am getting Illegal Character and missing ] after element list error.Here is how i am sending from Servicestack Service ..

var objSet = new List<Setup>()
{
   new Setup { Id = 1, Code = "73878", Name = "Systems", ContactName = "XYZ", ContactEmail = "info@systems.com", IsActive = true },
   new Setup { Id = 1, Code = "99878", Name = "Microsoft Systems",  ContactName= "Archit",ContactEmail = "enquiry@systems.com" ,IsActive = true }
};

return objSet ;

and this is how i am using in Razor View Page..

var dataSet = [@{
    foreach(var row in Model)
    {
        <text>[@row.Code,@row.Name,@row.ContactName,@row.ContactEmail]</text>
    }
}];

Please help me to resolve this issue..Thanks..

Are you creating <text> nodes with attributes? Shouldn't it be something like

   foreach(var row in Model)
        {
            string.Format("<text Id='{0}' Name='{1}' ConcatName='{2}' ConcatEmail='{3}'/>",row.Code,row.Name,row.ContactName,row.ContactEmail);
        }

But I must admit I don't use Razor and I'm not familiar with the syntax you use...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM