I am working with MVC3 c# 4.0.
I have created a partial view.
I have a button on my page, when I click this button I want to be able to load the partial view in to a modal popup. I presume the best way to do this is via javascript - I am using jQuery already in the application.
Any pointers as to how I could do this?
You could use jQuery UI dialog.
So you start by writing a controller:
then a
Modal.cshtml
partial that will contain the partial markup that you want to display in the modal:and an
Index.cshtml
view containing the button which will show the partial into a modal when clicked:Obviously in this example I have put the directly scripts into the Index view but in a real application those scripts will go into separate javascript file.