Spine.js local storage in Razor View

I need to use Spine to store Country and State values for dropdowns.

How would I load them into the dropdown in Razor from a Viewbag variable that is an array or objects?

How would I set their initial value based on another Viewbag variable?
LVL 26
Eddie ShipmanAll-around developerAsked:
Who is Participating?
 
Eddie ShipmanAll-around developerAuthor Commented:
I have already figure out how to do this so I won't be needing it, thanks for checking it out.

What we ended up doing was writing another controller action to call the webservice to get the states and call it in a .load() call from the country dropdown change event.
0
 
Bob LearnedCommented:
What I find myself doing is to use hidden variables on the view, but you can also use JQuery and AJAX to get a JSON object that you can use in your JavaScript.
0
 
Eddie ShipmanAll-around developerAuthor Commented:
HUH? The Country list and State list are returned from a webservice using WCF.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Bob LearnedCommented:
Are you trying to access those variables in JavaScript?
0
 
Bob LearnedCommented:
There are a lot of ways to approach a problem, so I am happy you found a JQuery solution.
0
 
Eddie ShipmanAll-around developerAuthor Commented:
Went another direction.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.