In the one of my previous article, I have explained how to create a simple master details entry form in asp.net MVC application, where I explained very simple one, without edit, delete functionality and all with text input field for details record for easy to understand.

Here in this article, I will show you how to create an advanced master details entry form with following added features.

1. Cascade drop-down in the details record.  an
2. Edit, delete functionality for edit/delete added details record.

This is our advance master-details entry form will look like. You can see here in this picture, I have added 2 drop-down for implement cascade functionality in details record, a delete button on each row for delete added records and I have made each row editable for make it possible to edit already added details record if required.

Just follow the following steps in order to implement "Advance master details entry form in asp.net MVC".

Here In this article, I have used Visual Studio 2013

Step - 1: Create New Project.

Step-2: Add a Database.

Now I will create a database for our application. As this is a tutorial project, I will add a database in our application, here in the app_data folder.

Step-3: Create tables in our database.

Now we have to create followings 4 tables in our database,  we will add one by one.

1. Categories 2. Products 3. OrderMaster 4. OrderDetails double click on the database under app_data folder  for open the database in server explorer > expand the database and Right click on Tables node > click on Add New Table >  here we will write schema of the table for the table we want to create > now click on Update button for create the table and then again click on Update Database button. Do the same procedure for create all 4 tables.

Step-4: Add Entity Data Model.

Step-5: Create an MVC Controller.

Here I have created a controller named "HomeController"

Step-6: Add an MVC action.

Here I have added "Index" Action to "Home" Controller. Please write this following code

Step-7: Add view for that(here Index action) action.

Right Click on Action Method (here right click on Index action) > Add View... > Enter View Name > Select "Empty" under Template dropdown  > > Add.

Note: Don't forget to add jQuery library in your _Layout.cshtml page, add this below code

Step-8: Add a javascript file, where we will add our client side code for save order to the database.

Here in our application, I will add a javascript file into Scripts folder.
If you don't already have Scripts folder in your application, please first add Scripts folder and then add a javascript file into this folder.
Go to solution explorer > Right click on "Scripts" folder > Add > new Item > Select Javascrip file under Scripts > Eneter file name (here in my application it is "myScripts.js") > and then click on Add button.

Step-9: Add an MVC action into HomeController for fetch product categories from the database and return as JsonResult.

Step-10: Add an another MVC action into HomeController for fetch Products from the database based on selected category.

Step-11: Add an another action for save order information to the database.

Step-12: Run Application.

We have done all the steps. Now it's time to run the application. But before run the application, make sure we have already some Product Category and Products inserted in our database.
[null, null, null, {"document_url": "http://www.dotnetawesome.com/2016/07/advance-master-details-entry-form-in-mvc.html", "unformatted_src": "https://1.bp.blogspot.com/-_k5c3xWcL04/V3oDJBou0EI/AAAAAAAACK8/AQ6S0yW4osUJuEaKGppmHHoGp729xoWJQCLcB/s1600/categories.PNG", "src": "https://1.bp.blogspot.com/-_k5c3xWcL04/V3oDJBou0EI/AAAAAAAACK8/AQ6S0yW4osUJuEaKGppmHHoGp729xoWJQCLcB/s1600/categories.PNG", "formatted_filename": "categories"}, null, {"document_url": "http://www.dotnetawesome.com/2016/07/advance-master-details-entry-form-in-mvc.html", "unformatted_src": "https://4.bp.blogspot.com/-Ch7r5l5lYro/V29lVpvOu2I/AAAAAAAACKI/u3UR-naaz-U90PHQpdEKJRJiEZ3Oywi4wCLcB/s1600/Products.PNG", "src": "https://4.bp.blogspot.com/-Ch7r5l5lYro/V29lVpvOu2I/AAAAAAAACKI/u3UR-naaz-U90PHQpdEKJRJiEZ3Oywi4wCLcB/s1600/Products.PNG", "formatted_filename": "Products"}, null, {"document_url": "http://www.dotnetawesome.com/2016/07/advance-master-details-entry-form-in-mvc.html", "unformatted_src": "https://2.bp.blogspot.com/-XMesTDHV6RA/V29lVkDIAAI/AAAAAAAACKE/ZVM8Rsrr0q0DdpoI6Dz0EM7qiSQWEeyfgCKgB/s1600/OrderMaster.PNG", "src": "https://2.bp.blogspot.com/-XMesTDHV6RA/V29lVkDIAAI/AAAAAAAACKE/ZVM8Rsrr0q0DdpoI6Dz0EM7qiSQWEeyfgCKgB/s1600/OrderMaster.PNG", "formatted_filename": "OrderMaster"}, null, {"document_url": "http://www.dotnetawesome.com/2016/07/advance-master-details-entry-form-in-mvc.html", "unformatted_src": "https://3.bp.blogspot.com/-2vIuN-2hAnQ/V29lVkvyN1I/AAAAAAAACKA/FJ53bF0_sJMm1jehqVRT5lc_XdQuPwHfACKgB/s1600/OrderDetails.PNG", "src": "https://3.bp.blogspot.com/-2vIuN-2hAnQ/V29lVkvyN1I/AAAAAAAACKA/FJ53bF0_sJMm1jehqVRT5lc_XdQuPwHfACKgB/s1600/OrderDetails.PNG", "formatted_filename": "OrderDetails"}, null, {"document_url": "http://www.dotnetawesome.com/2016/07/advance-master-details-entry-form-in-mvc.html", "unformatted_src": "//lh3.googleusercontent.com/-eX68wB4WnPk/AAAAAAAAAAI/AAAAAAAABgs/ZM6-vbUCT_I/s100-c/photo.jpg", "src": "http://lh3.googleusercontent.com/-eX68wB4WnPk/AAAAAAAAAAI/AAAAAAAABgs/ZM6-vbUCT_I/s100-c/photo.jpg", "formatted_filename": "photo", "rendered_width": 100, "rendered_height": 100}, null, null, null, null, null, null, null]