Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using ViewData to get a value from linq query, but the value returning is within a Square brackets and I need to get only the value inside the brackets.

What I have tried:

I have written the Jquery code as

var checkevents = JSON.parse('@Html.Raw(Json.Encode(ViewData["EventsList"]))');


and getting the output: [2] but I need only 2
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900