Loading the ResourceView from a ViewModel in MVC3

I’m trying to implement the scheduler in mvc3, and it works fine. But, i need to load the resources from a viewmodel class. Example A below is how the resources where loaded.
However, I would like to be able to do like Example B, using a for loop in the jquery section. Any suggestion would be appreciated. Thanks.

Example A

        var rooms = [
	{ key: 1, label: "Room A" },
	{ key: 2, label: "Room B" },
	{ key: 3, label: "Room C" },
	{ key: 4, label: "Room D" }

Example B
Foreach(r in MyViewModel.Resources)
var rooms = [
{ key: @r.RoomID, label: @r.RoomName}

Hello, check the sample from our blog
support.dhtmlx.com/x-files/sampl … emMVC3.zip

Thanks for the post! I’ll give it a try.