• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 684
  • Last Modified:

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?
0
Eddie Shipman
Asked:
Eddie Shipman
  • 3
  • 3
1 Solution
 
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
 
Bob LearnedCommented:
Are you trying to access those variables in JavaScript?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now