.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;








0















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



enter image description here



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];
);









share|improve this question






















  • 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


















0















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



enter image description here



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];
);









share|improve this question






















  • 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














0












0








0








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



enter image description here



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];
);









share|improve this question














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



enter image description here



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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


















  • 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

















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













1 Answer
1






active

oldest

votes


















1














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.






share|improve this answer

























  • 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











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
);



);













draft saved

draft discarded


















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









1














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.






share|improve this answer

























  • 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















1














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.






share|improve this answer

























  • 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













1












1








1







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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








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

















  • 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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript