Click here to Skip to main content
14,882,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I have a view that contains a highcharts graph. My ultimate goal is to be able to create a button that opens the highcharts graph into a new window.

I believe I have to pass the chart options to the controller and then pass it into the new view. I know how to pass values from the view to the controller then to a model and come back with some data. But I don't know how to pass data from the view to the controller and get another view, and better yet make it pop up into another window.

Any idea or tutorials I can go about this?
Posted

1 solution

What you probably want is for your new view to be under the same controller and for your data to be in the viewmodel for the first view. Then the second view can take that viewmodel as a parameter, and it will be passed in with the values from your page. I don't see why having target="_blank" to make it open a popup would change how that would work.

Just to add, you would have a form to post your redirect to this new view, and you would mark the view in the controller as httppost.
   
v2
Comments
Member 8336910 26-Jul-12 11:09am
   
View with Data -> (passes dictionary through ViewBag or ViewData) ->Controller ->
Pass dictionary to Model so it can be strongly typed -> pass it to a strongly typed view model ->And use ViewData or ViewBag to interpret it in Razor or ASPX. Correct? Kind of like this? http://stackoverflow.com/questions/6290742/how-can-i-transfer-information-of-one-view-to-another
Christian Graus 26-Jul-12 16:55pm
   
You're doing a full redirect, so you can pass your viewmodel with the changed values directly to the new page. You don't need a second viewmodel for that, or if you do, it can take the first viewmodel in a constructor to populate itself.

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