Last post Mar 27, 2012 06:47 AM by Matt_22
Mar 25, 2012 06:50 PM|Matt_22|LINK
I am new to ASP.Net MVC and would like some advice on how to create a view that allows the user to, for example, select some product details from a drop down list, enter quantity then click add and have the details added to a HTML table or maybe partial
Basic example for the view:
Product: [drop down list] Qty: [text box] Add [button]
Product [column] | Qty [Column] | Remove [column]
P1 | 10 | Remove [link/button]
P2 | 5 | Remove [link/button]
So when the user has selected a product and entered the qty they click add which inserts a row to the table (or some kind of list).
details, adds them to a List on the model then returns the same view and model which is then redisplayed in a table.
Just to give an overview of what I'm trying to do, this product list is going to be the first step in a wizard style view for a business application, so:
Step 1 - Enter products
Step 2 - Lookup Customer by name
If matching customers found then
Step 3 - Display existing customers for user to select from
Step 4 - Enter new customer details
Step 5 - Summay with submit button
Any help would be appreciated.
Mar 25, 2012 08:00 PM|rado_|LINK
can go with full page posts to the server
Mar 25, 2012 08:17 PM|kshyju|LINK
You can do in both ways. Using ajax and using the normal form posting approach.
<input type="button" id="btnAdd" value="Add" />
//Do with the response data
You can add the new item to tge kof available items in javasrtipt itseld using the jQuery append() method or you can do a get call fro a partia view which lists all the products.
Mar 25, 2012 08:20 PM|Matt_22|LINK
How would the product details be added to say a table using jQuery in a way that model binding still works?
Also, each step be better in a partial view?
I'm thinking I need one view with one model where the model has all the info I need to collect in each step but not sure how to display each step in a partial view and have all steps/partial view bound to the one model.
Mar 25, 2012 08:23 PM|kshyju|LINK
Check this example,
It has guidelines to create a wizard style app. You may need to customize based on your model.
Mar 25, 2012 08:55 PM|ignatandrei|LINK
and would like some advice on how to create a view that allows the user to, for example, select some product details from a drop down list, enter quantity then click add and have the details added to a HTML table or maybe partial view.
Mar 27, 2012 06:47 AM|Matt_22|LINK
Thanks for the replies, they have all helped.
ignatandrei - Thanks for the link. The example project showing how to use jQuery to get json data from the controller was a great help.