I have a model in MVC 3 that i’m passing into a strongly typed view, the model contains information about an employee. Here is where I am having trouble. I have an edit button that when I press it, it should open a modal box with with all the labels for the employee info in text box form and pre filled with the info from the model.
right now i’m using javascript to find the label elements and then get their innerText. This seems to work fine, but I would really like to stick to using a model as much as I can because some of the labels when you go to edit them aren’t free text they are going to need to be drop downs.
Just any information about why I shouldn’t or should do it with JavaScript.
For this type of situation I usually make an ajax call to the server and have that return a partial view. Then use jQuery to put the returned partial view into your modal popup.
Here’s a brief list of what you should need to make this happen: