所以2个问题,我的html.multiselectlist工作正常,但我想做2件事......
这是我的控制器代码,因此我需要执行此任务,或直接在我的视图或视图模型中:
Inherits Controller
Dim _DB As New BlackBoxNormalizedEntities()
' Main / Default Lander for TFS Section
Function TFSMain() As ActionResult
Dim AccTypeList = (From m In _DB.LibAcctType Select m).ToList()
Dim TrxnTypeList = (From m In _DB.LibTrxnTyp Select m).ToList()
Dim ActnCodeList = (From m In _DB.LibActnCode Select m).ToList()
Dim viewModel As New TFS_VModel()
viewModel.AccType = AccTypeList
viewModel.Trxntype = TrxnTypeList
viewModel.ActnCode = ActnCodeList
viewModel.TStatus = viewModel.TStatus
Return View(viewModel)
End Function
答案 0 :(得分:0)
您应该在Action中构建并填充MultiSelectList作为ViewModel的一部分,而不是在View中,并将ViewModel呈现给View。