I have created an MVC application where the user fills in a form of data. I am having a problem with retrieving the values that the user selected in the dropdownlists. I can successfully get all the other information from the page (for example the summary I can retrieve with is a textbox).
Here is what I have got so far:
ViewModel:
Public Class ClientUserProjectIssue
Public Property proTableList As List(Of ProjectType)
Public Property IssueTable As IssueTable
End Class
Here is my View:
@ModelType IssueTracker.ClientUserProjectIssue
@Html.DropDownList("ProjectTypeID", New SelectList(Model.proTableList, "ProjectTypeID", "ProjectTypeName"), "Please Select")
@Html.EditorFor(Function(model) model.iTable.IssueSummary)
Here is my Controller:
Public Function SubmitIssue(test As IssueTracker.ClientUserProjectIssue) As ActionResult
Dim issTable As New IssueTable
issTable.IssueSummary = test.IssueTable.IssueSummary
issTable.ProjectTypeID = 1
'issTable.ProjectTypeID = test.IssueTable.ProjectTypeID (this is what I would like to do, but it doesn't get the ID
Using db As New DatabaseEntities
db.IssueTables.Add(issTable)
db.SaveChanges()
End Using
Return RedirectToAction("SubmitSuccess")
End Function
How can I successfully get the value of the ProjectTypeID from the list as this is not working?