0

I have created a page Main.html in witch there is a ViewModel. In this page there is a button that open a Window Modal and load in it a html page in ajax.

I want to use the viewmodel of the main.html in my window modal, but if I call the viewmodel it do error..

Does someone know how can I resolve?

Pablo Claus
  • 5,886
  • 3
  • 29
  • 38
Ciccio
  • 468
  • 4
  • 17
  • Could you put some code? What error do you receive? – Pablo Claus Jan 23 '13 at 16:07
  • AFAIK if you load a page via `ajax` it uses an `iframe` for containing it. For accessing container page data from an `iframe` take a look into http://stackoverflow.com/a/1301645/1802671 – OnaBai Jan 23 '13 at 17:08

1 Answers1

0

Load a partial view in to your modal and make sure it has the proper using statement to allow it to use your model:

@using YourApp.YourModels.TheModel
GP24
  • 867
  • 2
  • 13
  • 28
  • I have resolve. in the main js i have put a return { viewmodel: viewmodel } so it function on the other js file. thank you very much – Ciccio Jan 24 '13 at 10:47