I am about to plan a purchase with a new customer again for the suite and I am using the latest demo. I was trying to get the value from the form that I placed my control in. I need to gain access in this field .DataValueField("Id") which would be bound to the form when its posted but when I access tag item its null
<
form
asp-action
=
"LinkToCase"
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("Id")
.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
class
=
"btn-primary"
value
=
"Link To Case"
style
=
" background-color:#1e3f5a;color:white"
>Link To Case</
button
>
</
div
>
<
script
>
function onAdditionalData() {
return {
text: $("#customers").val()
};
}
</
script
>
public IActionResult LinkToCase(int tagItem, string sesearchOptionsr) {
Int32.TryParse(TempData.Peek("CaseId").ToString(), out int resultCaseId);
POI newPoi = new POI();
newPoi = _context.Pois.SingleOrDefault(w => w.Id == tagItem);
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 });
}