-1

I am working on an app where I want to collect which resource was sold and how much of it. I would also like to do reports on this to find out how much of one item was sold. This is proving to be a bit troublesome for a few reasons

thinking in terms of a C# windows app I was thinking about having a grid, with a combo box of the items as a column. This would allow me to enter a quantity and then select what Item from my drop down. I would then save the customerID,items and amounts to a separate table where I can query for my report.

Sadly, I am not aware of a method of adding records to a grid in MVC 5. But I have my grid already created. I am a little stumped in creating an action link in MVC to keep adding rows to a grid and save to a database.

Thanks for any help offered.

DWright
  • 9,258
  • 4
  • 36
  • 53
Liberace
  • 81
  • 1
  • 11
  • A pure client side example of dynamically adding items to your view is shown in [this answer](http://stackoverflow.com/questions/29837547/set-class-validation-for-dynamic-textbox-in-a-table/29838689#29838689), but it would be easier to use the [BeginCollectionItem](https://www.nuget.org/packages/BeginCollectionItem/) helper –  May 07 '15 at 04:31
  • 2
    I fixed all occurrences of MCV to say MVC. – DWright May 07 '15 at 04:31

1 Answers1

2

This example http://www.codeproject.com/Articles/786085/ASP-NET-MVC-List-Editor-with-Bootstrap-Modals should get you going. Although you don't need to use Bootstrap it has all the necessary to show you how it is done.

In terms of an MVC grid there are a number out there and depending on the one you chose the way to interact with it may be slightly different in each case. But roughly speaking you make AJAX calls back to your MVC controller to perform the various CRUD operations. Here is a good starting point on available grids:

http://www.agile-code.com/blog/list-of-asp-net-mvc-grid/

TheEdge
  • 9,291
  • 15
  • 67
  • 135