我的场景是好的我有一个多选列表框,我想要的是当我们选择多个记录并按下按钮时,我应该在控制器的调用方法中选择项目列表。我的代码在下面
csthml 代码:
@{
Layout = "";
}
@using Telerik.Web.Mvc.UI;
@using System.Web;
@using System.Web.UI.WebControls;
@using System.Web.Mvc;
@model Nop.Plugin.Import.Product.Models.ImportProductModel
<div>
<div class="section-header">
<div class="options">
@using (Html.BeginForm("ImportSelected", "ImportProduct"))
{
<button type="submit">OK</button>
}
</div>
</div>
<table>
<tr>
<td>
@Html.ListBox("Items", Model.nopCommerceCategories);
</td>
<td>
@Html.ListBox("Items", Model.ClockCategories);
</td>
</tr>
<tr>
<td>
@using (Html.BeginForm("SaveMapping", "ImportProduct"))
{
<button type="submit">Save</button>
}
</td>
</tr>
</table>
</div>
模型 :
using System.Collections.Generic;
using System.Web.Mvc;
using Nop.Core.Domain.Catalog;
namespace Nop.Plugin.Import.Product.Models
{
public class ImportProductModel
{
public List<SelectListItem> nopCommerceCategories { get; set; }
public List<SelectListItem> ClockCategories { get; set; }
}
}