.NET Core View page's values to JavaScript arrayRead the first column values of a HTML table with jqueryWhich “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?How do I check if an array includes an object in JavaScript?How to insert an item into an array at a specific index (JavaScript)?Set a default parameter value for a JavaScript functionHow can I get query string values in JavaScript?Sort array of objects by string property valueHow do I empty an array in JavaScript?Loop through an array in JavaScriptHow do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?
Does Peach's float negate shorthop knockback multipliers?
1980s (or earlier) book where people live a long time but they have short memories
How certain is a caster of when their spell will end?
Do adult Russians normally hand-write Cyrillic as cursive or as block letters?
Could the Missouri River be running while Lake Michigan was frozen several meters deep?
Is the capacitor drawn or wired wrongly?
How bad would a partial hash leak be, realistically?
How do you build a story from a world?
How were concentration and extermination camp guards recruited?
How to decline physical affection from a child whose parents are pressuring them?
Can you please explain this joke: "I'm going bananas is what I tell my bananas before I leave the house"?
I wrote a scene that the majority of my readers loved. How do I get back to that place while writing my new book?
Do I include animal companions when calculating difficulty of an encounter?
When writing an error prompt, should we end the sentence with a exclamation mark or a dot?
What makes linear regression with polynomial features curvy?
Is the decompression of compressed and encrypted data without decryption also theoretically impossible?
Is it possible for people to live in the eye of a permanent hypercane?
Accidentally renamed tar.gz file to a non tar.gz file, will my file be messed up
In this example, which path would a monster affected by the Dissonant Whispers spell take?
Why is Colorado so different politically from nearby states?
correct term describing the action of sending a brand-new ship out into its first seafaring trip
You've spoiled/damaged the card
How to make a setting relevant?
Count down from 0 to 5 seconds and repeat
.NET Core View page's values to JavaScript array
Read the first column values of a HTML table with jqueryWhich “href” value should I use for JavaScript links, “#” or “javascript:void(0)”?How do I check if an array includes an object in JavaScript?How to insert an item into an array at a specific index (JavaScript)?Set a default parameter value for a JavaScript functionHow can I get query string values in JavaScript?Sort array of objects by string property valueHow do I empty an array in JavaScript?Loop through an array in JavaScriptHow do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am developing an application in .NET Core MVC. In my View page, I have a table like this table here. Which generates using foreach loop.
foreach (var items in Model)
// generate Table
What I want is, Not to show this table. Instead, When the Page loads, Pass this values to JavaScript Array and show some dynamic charts.
For example, The Amount column in the table. I want to get the amount values in javascript like:
$( document ).ready(function()
var amountValues = [1000, 3000, 2000, 1100];
);
javascript jquery asp.net-core .net-core asp.net-core-mvc
add a comment |
I am developing an application in .NET Core MVC. In my View page, I have a table like this table here. Which generates using foreach loop.
foreach (var items in Model)
// generate Table
What I want is, Not to show this table. Instead, When the Page loads, Pass this values to JavaScript Array and show some dynamic charts.
For example, The Amount column in the table. I want to get the amount values in javascript like:
$( document ).ready(function()
var amountValues = [1000, 3000, 2000, 1100];
);
javascript jquery asp.net-core .net-core asp.net-core-mvc
Check stackoverflow.com/questions/12752834/… if it helps you
– Priyank Panchal
Mar 24 at 13:49
Is there any reason you need to change theamountValues
? Why don't set it at the server side byModel
? What do you mean by dynamic charts? What is your expected result?
– Tao Zhou
Mar 25 at 2:13
add a comment |
I am developing an application in .NET Core MVC. In my View page, I have a table like this table here. Which generates using foreach loop.
foreach (var items in Model)
// generate Table
What I want is, Not to show this table. Instead, When the Page loads, Pass this values to JavaScript Array and show some dynamic charts.
For example, The Amount column in the table. I want to get the amount values in javascript like:
$( document ).ready(function()
var amountValues = [1000, 3000, 2000, 1100];
);
javascript jquery asp.net-core .net-core asp.net-core-mvc
I am developing an application in .NET Core MVC. In my View page, I have a table like this table here. Which generates using foreach loop.
foreach (var items in Model)
// generate Table
What I want is, Not to show this table. Instead, When the Page loads, Pass this values to JavaScript Array and show some dynamic charts.
For example, The Amount column in the table. I want to get the amount values in javascript like:
$( document ).ready(function()
var amountValues = [1000, 3000, 2000, 1100];
);
javascript jquery asp.net-core .net-core asp.net-core-mvc
javascript jquery asp.net-core .net-core asp.net-core-mvc
asked Mar 24 at 13:37
Shunjid Rahman ShowrovShunjid Rahman Showrov
3117
3117
Check stackoverflow.com/questions/12752834/… if it helps you
– Priyank Panchal
Mar 24 at 13:49
Is there any reason you need to change theamountValues
? Why don't set it at the server side byModel
? What do you mean by dynamic charts? What is your expected result?
– Tao Zhou
Mar 25 at 2:13
add a comment |
Check stackoverflow.com/questions/12752834/… if it helps you
– Priyank Panchal
Mar 24 at 13:49
Is there any reason you need to change theamountValues
? Why don't set it at the server side byModel
? What do you mean by dynamic charts? What is your expected result?
– Tao Zhou
Mar 25 at 2:13
Check stackoverflow.com/questions/12752834/… if it helps you
– Priyank Panchal
Mar 24 at 13:49
Check stackoverflow.com/questions/12752834/… if it helps you
– Priyank Panchal
Mar 24 at 13:49
Is there any reason you need to change the
amountValues
? Why don't set it at the server side by Model
? What do you mean by dynamic charts? What is your expected result?– Tao Zhou
Mar 25 at 2:13
Is there any reason you need to change the
amountValues
? Why don't set it at the server side by Model
? What do you mean by dynamic charts? What is your expected result?– Tao Zhou
Mar 25 at 2:13
add a comment |
1 Answer
1
active
oldest
votes
You could serialize the Model into a javascript class and use as you want:
var myModel = @Html.Raw(Json.Serialize(Model));
for (var item in myModel)
var amountValue = item.Amount;
//push to array etc.
why the surrounding@
? That's a code block so nothing should be output in the html.
– Erik Philips
Mar 24 at 21:26
yea you are right, must have been some rapid prototyping a little too rapid :) It's removed now
– Morten_564834
Mar 25 at 6:21
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324372%2fnet-core-view-pages-values-to-javascript-array%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could serialize the Model into a javascript class and use as you want:
var myModel = @Html.Raw(Json.Serialize(Model));
for (var item in myModel)
var amountValue = item.Amount;
//push to array etc.
why the surrounding@
? That's a code block so nothing should be output in the html.
– Erik Philips
Mar 24 at 21:26
yea you are right, must have been some rapid prototyping a little too rapid :) It's removed now
– Morten_564834
Mar 25 at 6:21
add a comment |
You could serialize the Model into a javascript class and use as you want:
var myModel = @Html.Raw(Json.Serialize(Model));
for (var item in myModel)
var amountValue = item.Amount;
//push to array etc.
why the surrounding@
? That's a code block so nothing should be output in the html.
– Erik Philips
Mar 24 at 21:26
yea you are right, must have been some rapid prototyping a little too rapid :) It's removed now
– Morten_564834
Mar 25 at 6:21
add a comment |
You could serialize the Model into a javascript class and use as you want:
var myModel = @Html.Raw(Json.Serialize(Model));
for (var item in myModel)
var amountValue = item.Amount;
//push to array etc.
You could serialize the Model into a javascript class and use as you want:
var myModel = @Html.Raw(Json.Serialize(Model));
for (var item in myModel)
var amountValue = item.Amount;
//push to array etc.
edited Mar 25 at 6:20
answered Mar 24 at 21:24
Morten_564834Morten_564834
4581415
4581415
why the surrounding@
? That's a code block so nothing should be output in the html.
– Erik Philips
Mar 24 at 21:26
yea you are right, must have been some rapid prototyping a little too rapid :) It's removed now
– Morten_564834
Mar 25 at 6:21
add a comment |
why the surrounding@
? That's a code block so nothing should be output in the html.
– Erik Philips
Mar 24 at 21:26
yea you are right, must have been some rapid prototyping a little too rapid :) It's removed now
– Morten_564834
Mar 25 at 6:21
why the surrounding
@
? That's a code block so nothing should be output in the html.– Erik Philips
Mar 24 at 21:26
why the surrounding
@
? That's a code block so nothing should be output in the html.– Erik Philips
Mar 24 at 21:26
yea you are right, must have been some rapid prototyping a little too rapid :) It's removed now
– Morten_564834
Mar 25 at 6:21
yea you are right, must have been some rapid prototyping a little too rapid :) It's removed now
– Morten_564834
Mar 25 at 6:21
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55324372%2fnet-core-view-pages-values-to-javascript-array%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Check stackoverflow.com/questions/12752834/… if it helps you
– Priyank Panchal
Mar 24 at 13:49
Is there any reason you need to change the
amountValues
? Why don't set it at the server side byModel
? What do you mean by dynamic charts? What is your expected result?– Tao Zhou
Mar 25 at 2:13