Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# asp.net core mvc中的剑道Ui无法获取DataValueField值_C#_Twitter Bootstrap_Asp.net Core_Model View Controller_Kendo Ui - Fatal编程技术网

C# asp.net core mvc中的剑道Ui无法获取DataValueField值

C# asp.net core mvc中的剑道Ui无法获取DataValueField值,c#,twitter-bootstrap,asp.net-core,model-view-controller,kendo-ui,C#,Twitter Bootstrap,Asp.net Core,Model View Controller,Kendo Ui,我正在使用剑道多列下拉列表,但我似乎无法从DatValueField中获取值。我正在使用该值获取所选人员的id,以便能够将其存储在另一个表中 如果有人能告诉我如何复制相同的引导请做telerik不是我唯一的答案这里宁愿避免tbh <form asp-action="LinkToCase" method="post" asp-controller="MISObjects"> <div class="row&

我正在使用剑道多列下拉列表,但我似乎无法从DatValueField中获取值。我正在使用该值获取所选人员的id,以便能够将其存储在另一个表中

如果有人能告诉我如何复制相同的引导请做telerik不是我唯一的答案这里宁愿避免tbh

<form asp-action="LinkToCase" method="post" asp-controller="MISObjects">

 <div class="row">
    <div class="col-md-12">
        <div class="card card-success">

        <div class="card-header" style="background-color:#1e3f5a;color:white">
            <h3 class="card-title">Search and Tag</h3>
        </div>
        <div class="card-body">

            <div class="col-md-12">
                <div class="input-group">
                    <select id="searchOptions" name="searchOptions" style="background-color: #1e3f5a; color: white; width: 140px; height: 45px">
                        <option selected value="1">Poi</option>
                        <option selected value="1">Vessel</option>
                    </select>


                    @(Html.Kendo().MultiColumnComboBox()
                        .Name("tagItem")
                        .DataTextField("name")
                        .DataValueField("SearchId")
                        .Filter("contains")
                        .FilterFields(new string[] { "name", "ContactTitle", "CompanyName", "Country" })
                        .Columns(columns =>
                        {
                            columns.Add().Field("name").Title("Contact Name").Width("200px");
                            columns.Add().Field("dob").Title("Date Of Brith").Width("200px");

                        })
                        .FooterTemplate("Total #: instance.dataSource.total() # items found")
                        .HtmlAttributes(new { style = "width:80%;" })
                        .Height(400)
                        .DataSource(source => source
                            .Custom()
                            .Transport(transport => transport
                                .Read(read =>
                                {
                                    read.Action("SearchQuery", "MISObjects")
                                        .Data("onAdditionalData");
                                }))
                        )
                        )
                    <button type="submit" class="btn-primary" value="Link To Case" style=" background-color:#1e3f5a;color:white">Link To Case</button>

                 </div>
       </div>
   </div>
</form>

搜索和标记
Poi
容器
@(Html.Kendo().MultiColumnComboBox())
.名称(“标记项”)
.DataTextField(“名称”)
.DataValueField(“搜索ID”)
.过滤器(“包含”)
.FilterFields(新字符串[]{“名称”、“联系人名称”、“公司名称”、“国家”})
.列(列=>
{
columns.Add().字段(“姓名”).标题(“联系人姓名”).宽度(“200px”);
columns.Add().字段(“dob”).标题(“英国日期”).宽度(“200px”);
})
.FooterTemplate(“总计#:实例.dataSource.Total()#找到项”)
.HtmlAttributes(新的{style=“width:80%;”})
.身高(400)
.DataSource(source=>source
.Custom()
.运输(运输=>运输
.Read(Read=>
{
read.Action(“SearchQuery”、“MISObjects”)
.数据(“非附加数据”);
}))
)
)
链接到案例
剑道组合调用这个函数

[HttpPost]
public IActionResult LinkToCase(int SearchId,string updateInfo, int tagItem, string sesearchOptionsr, IFormCollection formItems) {
    
      Int32.TryParse(TempData.Peek("CaseId").ToString(), out int resultCaseId);
      var test = formItems;
        POI newPoi = new POI();
        newPoi =  _context.Pois.SingleOrDefault(w => w.Id == SearchId);

        newPoi.MISObjectId = resultCaseId;

        _context.Pois.Add(newPoi);

        _toast.AddSuccessToastMessage(
            $"You have linked {newPoi.FirstName} {newPoi.LastName} to case {resultCaseId:d8}");

        return RedirectToAction("Edit", new { id = resultCaseId });

    }
    private IEnumerable<SearchViewModel> GetSearchRecords() {
        return _context.Pois.Where(w => w.isActive == true && w.isDeleted == false).Select(person =>
             new SearchViewModel {
                 SearchId = person.Id,
                 Name = person.FirstName + "  " + person.LastName,
                 DOB = person.DOB
             }).ToList();

  }
[HttpPost]
public IActionResult LinkToCase(int-SearchId、string-updateInfo、int-tagItem、string-sesearchOptionsr、FormCollection Forms){
Int32.TryParse(TempData.Peek(“CaseId”).ToString(),out int resultCaseId);
var检验=formItems;
POI newPoi=新POI();
newPoi=_context.poi.SingleOrDefault(w=>w.Id==SearchId);
newPoi.MISObjectId=resultCaseId;
_context.poi.Add(newPoi);
_toast.AddSuccessToastMessage(
$“您已将{newPoi.FirstName}{newPoi.LastName}链接到案例{resultCaseId:d8}”);
返回RedirectToAction(“Edit”,new{id=resultCaseId});
}
私有IEnumerable GetSearchRecords(){
return\u context.Pois.Where(w=>w.isActive==true&&w.isDeleted==false)。选择(person=>
新的SearchViewModel{
SearchId=person.Id,
Name=person.FirstName+“”+person.LastName,
DOB=person.DOB
}).ToList();
}
但即使当我检查SearchId时,它也是空白的,即使我将它设置为int类型,我也会在跟踪过程中输入一张支持票,但看到他们的是剑道标记,所以我想也可以在这里尝试

编辑2

正如您在下面看到的,在表单集合项中找不到该值


如果我正确地阅读了您的代码,我觉得您想要的SearchId值应该已经在控制器方法的tagItem int参数中,因为这是表单中MultiColumnComboBox的名称。该多栏组合框绑定到一个列表,该列表的值字段为SearchId,这是不同的,在提交时不会发回。

您可能会这样认为,但返回的不是姓名而不是ID。您是否可以从控制器中包含SearchQuery代码,我也找到了此线程,我知道它与您使用的控件不同,但行为似乎匹配: