Hi I have a razor view in my MVC 3 application using a @model IList<TrackerModel>

IList<TrackerModel> is being passed to the view from a action method in my controller. As the name suggests it's a list of TrackerModels.

I want to pass this list the the javascript block at the bottom of my view.

Run the list through a foreach loop so that each model makes use of a certain function. eg.

foreach(var mod in IList<TrackerModel>)
{
     LoadAttachments();
}

(I know the above is wrong, but you get the idea) Can this be done ?

   @foreach(var mod in Model)
{
    LoadAttachments(@Newtonsoft.Json.JsonConvert.SerializeObject(mod));
}

tried the above suggestion , and got the following errors. @foreach = condition compilation is turned off ?

var = Expected expression ?

in = expected ; ?

LoadAttachments = the name 'LoadAttachments ' does not exist in the current context ?

@Newtonsoft = condition compilation is turned off ?

Related posts

Recent Viewed