Selecting and saving values ​​from a list in SQL DB

Scenario: we have a list in our MVC View, and the user has the opportunity to select several values. I would like to keep these selected values ​​(if possible?) As a comma-delimited cell value in our SQL '08 database.

The figure below shows what I'm trying to explain. Pay attention to the choice in LISTBOX Thank you in advance!

View of Listbox selections Here we save the values ​​passed in the values ​​from the DDL position (Listbox w / mulitple highlights).

> <HttpPost()>
>         Function Edit(wsmonitor As WSMonitor, ByVal vbpositionnumberDDL As Integer, ByVal PassedCounty As Integer, ByVal
> MonitorTypeDDL As String) As ActionResult
>             wsmonitor.PositionNumber = vbpositionnumberDDL
>             wsmonitor.MonitorType = MonitorTypeDDL
>             wsmonitor.county = PassedCounty
> 
>             If ModelState.IsValid Then
>                 db.Entry(wsmonitor).State = EntityState.Modified
>                 db.SaveChanges()
>                 Return RedirectToAction("Index")
>             End If
> 
>             Return View(wsmonitor)
>         End Function
+3
source share
1 answer

, . vbpositionnumberDDL .

iten . .

VB.NET , ,

Function Edit(wsmonitor As WSMonitor, ByVal vbpositionnumberDDL As **String()**, ByVal PassedCounty As Integer, ByVal
> MonitorTypeDDL As String) As ActionResult

Dim foo = [String].Join(",", vbpositionnumberDDL )
0

All Articles