Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Array with keys ASPNET/Razor
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Skythrust" data-source="post: 474307" data-attributes="member: 87030"><p>Goodafternoon all!</p><p></p><p>I am trying to rebuild one of my application from PHP to ASP with Razor. </p><p>When I pick up the array plain from my Postman output and I paste this VS is not able to read this.</p><p></p><p>I have searched on Google to find a fix for this what I am doing wrong, but I can't really find a solution for this.</p><p></p><p>There a 2 lines, one of them is working (Members), the other one (MembersWithKeys) is not working.</p><p>Does anyone have an idea what's going wrong over here? </p><p></p><p>[CODE=csharp]@page</p><p>@model IndexModel</p><p></p><p>@{</p><p> string[] Members = {"John", "Jane", "Jhon"};</p><p> string[] MembersWithKey = [{ "Firstname":"John","Lastname":"Doe","Age":"37"},{ "Firstname":"Jane","Lastname":"Doe","Age":"27"},{ "Firstname":"Jhon","Lastname":"Doe","Age":"41"}];</p><p>}</p><p></p><p>@foreach (var Person in Members)</p><p>{</p><p> <button>@Person</button></p><p>}</p><p></p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="Skythrust, post: 474307, member: 87030"] Goodafternoon all! I am trying to rebuild one of my application from PHP to ASP with Razor. When I pick up the array plain from my Postman output and I paste this VS is not able to read this. I have searched on Google to find a fix for this what I am doing wrong, but I can't really find a solution for this. There a 2 lines, one of them is working (Members), the other one (MembersWithKeys) is not working. Does anyone have an idea what's going wrong over here? [CODE=csharp]@page @model IndexModel @{ string[] Members = {"John", "Jane", "Jhon"}; string[] MembersWithKey = [{ "Firstname":"John","Lastname":"Doe","Age":"37"},{ "Firstname":"Jane","Lastname":"Doe","Age":"27"},{ "Firstname":"Jhon","Lastname":"Doe","Age":"41"}]; } @foreach (var Person in Members) { <button>@Person</button> } [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Array with keys ASPNET/Razor
Top