Hi,
It seems that this should be very simple, but I can't make it work. I pass a list of items to the view, edit some of the fields, and post the edited list back to the controler. They go to the view fine, but I am unable to get at the posted model. Could someone point me in the right direction. I am a bit of a novice in this area. Thanks
View:
@ModelType IEnumerable(Of gbip_new.quoteDetails_Result)
@Code
ViewData("Title") = "quoteDetails"
End Code
@Using Html.BeginForm()
@Html.ValidationSummary(True)
@<fieldset>
<legend>Quote</legend>
<table>
<tr>
<th>
@Html.DisplayNameFor(Function(model) model.employeeId)
</th>
<th>
@Html.DisplayNameFor(Function(model) model.employeeName)
</th>
<th>
@Html.DisplayNameFor(Function(model) model.bundleId)
</th>
<th>
@Html.DisplayNameFor(Function(model) model.bundleDescription)
</th>
<th>
@Html.DisplayNameFor(Function(model) model.packageId)
</th>
<th>
@Html.DisplayNameFor(Function(model) model.packageContents)
</th>
<th></th>
</tr>
@For Each item In Model
Dim currentItem = item
@<tr>
<td>
@Html.DisplayFor(Function(modelItem) currentItem.employeeId)
</td>
<td>
@Html.DisplayFor(Function(modelItem) currentItem.employeeName)
</td>
<td>
@Html.EditorFor(Function(modelItem) currentItem.bundleId)
</td>
<td>
@Html.DisplayFor(Function(modelItem) currentItem.bundleDescription)
</td>
<td>
@Html.EditorFor(Function(modelItem) currentItem.packageId)
</td>
<td>
@Html.DisplayFor(Function(modelItem) currentItem.packageContents)
</td>
</tr>
Next
</table>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
End Using
Model (Generated)
Partial Public Class QuoteDetails_Result
Public Property id As Integer
Public Property corpId As Nullable(Of Integer)
Public Property quoteId As Nullable(Of Integer)
Public Property employeeId As Nullable(Of Integer)
Public Property bundleId As Nullable(Of Integer)
Public Property packageId As Nullable(Of Integer)
Public Property soldDate As Nullable(Of Date)
Public Property createDate As Nullable(Of Date)
Public Property effectiveDate As Nullable(Of Date)
Public Property renewalDate As Nullable(Of Date)
Public Property processDate As Nullable(Of Date)
Public Property typeId As Nullable(Of Integer)
Public Property firstName As String
Public Property lastName As String
Public Property middleName As String
Public Property employeeName As String
Public Property bundleContents As String
Public Property bundleDescription As String
Public Property packageContents As String
Public Property packageDescription As String
End Class
Controler:
<HttpPost()> _
Function QuoteDetails(ByVal eqDetails As IEnumerable(Of Global.gbip_new.QuoteDetails_Result)) As ActionResult
If ModelState.IsValid Then
'Do Stuff
Return RedirectToAction("Index")
End If
Return View(eqDetails)
End Function