i have recently moved from ASP.Net WebForms to ASP.Net MVC and having trouble with deciding on how to move forward with a particular implementation of a Modal and GUI design.
This is the Model:

I want to design a Create page on which the User details can be entered, as well as a list (bootstrap-table) of User_Customers for that User.

When clicking on the green + button at the right-bottom, I would like to show a bootstrap modal window in which a User_Customer can be added.

I have thought of the following 2 options:
- Add the User_Customer on the client with jQuery. Use proper naming and indexes so that the list is received on the server when the User hits the "Create' button.
- Perform an intermediate postback and add the User_Customer on the server. Not sure what to add the User_Customer to, as the User record does not exist yet until the complete form is posted back.


Suraj SahooRank #382 · 6.6K reputationPosted Jan 13, 2015, 4:14 AM EST
On click on the Add button,
1-You need to make an ajax call with posting the data like:
$.ajax({
url:"/CONTROLLER/ACTION",
type:"POST",
data:$("#FORMID").serialize(), //serialize would send the form values in key value pair
success: function(){
$("#MODALID").modal('hide');
location.reload();//this method would let the grid on that page on window refresh and call the server and populate the data just added, so no need to postback again
}
});
I hope if my anticipation is correct this would help you.
Please post back your queries if any.
Thanks. :)
Pinpoint Solutions11 reputationPosted Jan 11, 2015, 11:09 PM EST
Pinpoint Solutions11 reputationPosted Jan 13, 2015, 8:22 PM EST
Suraj SahooRank #382 · 6.6K reputationPosted Jan 14, 2015, 6:26 AM EST
Pinpoint Solutions11 reputationPosted Jan 21, 2015, 1:56 AM EST