English 中文(简体)
选择和挽救从名单箱到卡片行的价值观
原标题:Select and Saving values from listbox to SQL DB

设想: 我们的多指标类集调查中有一个清单箱,用户能够强调多种价值观。 因此,我能够把这些选定的价值(如果可能的话)作为我们08国库数据库的 com化电池价值。

以下形象显示了我试图解释的内容。 Note the selected in the LISTBOX 提前感谢!

View of Listbox selections This is where we save the passed in values from the Positionnumber DDL (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
问题回答

You need to ensure the name field of your listbox matches the parameter in your Edit method. Then, change the Type of the parameter vbpositionnumberDDL to be a string array.

You will then get passed in an array with each selected iten in the list box. It s then easy to convert that to your comma string.

My 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 )




相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签