3
我新的ASP.NET MVC和劍道UI框架,並具有以下問題:劍道多選,將經過選擇的值到控制器
我有與接收了其值多選一個窗口partialview數據庫。該視圖的樣子:
@model SoftwareAdminInterface.Models.Administration.Pattern
<div id="myContentPopupEditRole_div">
@using (Ajax.BeginForm("SetCombi", "Pattern", new { }, new AjaxOptions() { HttpMethod = "post", UpdateTargetId = "myContentPopupEditRole_div" }))
{
<center>
<br />
<table class="table_no_borders">
<tr>
<td style="width: 300px">
@(
Html.Kendo().MultiSelectFor(model => model.RegExId)
.MaxSelectedItems(2)
.Name("RegExID")
.DataTextField("RegExName")
.DataValueField("RegExID")
.Placeholder("Select Patterns...")
.AutoBind(false)
.DataSource(source => {
source.Read(read =>
{
read.Action("GetPatternsForCombi", "Pattern");
})
.ServerFiltering(true);
})
)
</td>
</tr>
</table>
<button class="k-button k-button-icontext k-grid-custom" id="get" type="submit">@Resources.General.BtnSave</button>
</center>
}
</div>
我使用了一個模型,它看起來像這樣:
public class Pattern
{
[ScaffoldColumn(false)]
public int RegExID { get; set; }
[Display(Name = "RegEx")]
[Required]
public string RegExName { get; set; }
[UIHint("GridForeignKey")]
public int CategoryID { get; set; }
public string CategoryName { get; set; }
public string ColumnName { get; set; }
public string RegExTable { get; set; }
[UIHint("GridForeignKey")]
public int? TableID { get; set; }
public string Version { get; set; }
public string Description { get; set;
}
在被稱爲在patterncontroller的SetCombi功能
,我只希望接收的兩個ID的所選對象不在多選中,但我不知道應該如何將它們發送給控制器。
THX在您的幫助
我想你會得到以逗號分隔的格式選擇的值。您需要分割它並獲取單個選定的值。 – ckv