1

I am facing some issue with razor syntax to pass list of string with partial view. Here is my code :

<ul class="nav navbar-nav">
        @{ IList<string> model = new List<string> {"nb-NO", "nn-NO", "sv-SE", "da-DK", "en-GB", "se-NO", "fi-FI", "de-DE"}; }
        <li>@Html.Partial("_AppLanguage", model)</li>
</ul>

when i execute, it shows me this error:

enter image description here

Can anybody tell me whats the wrong in my code ?

1 Answer 1

2

Ok. I got my solution. The issue is not in my razor syntax. The issue was in my _AppLanguage partial view. There i made a mistake to grub the model. I used @{var model = @Model;} instead of @{var model = Model;}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.