Hi,
I am trying to get the id of the selected entry in a combo box on a Razor page.
I modelled the code on the DatePicker example from the Razor examples.
I added a DatePicker to my page along with my Combo box.
The page loads and the combo box loads its entries. When I make a selection, the page does a post and my OnPost handler is called.
The value for the DatePicker is there but the ComboBox returns a null value.
I have enclosed screen shots of my cshtml and cshtml.cs pages. The DatePicker and ComboBox are setup identically as far as I can tell.
Any suggestions on what I might be doing wrong.
Thanks,
Charlotte
<form method="post">
public void OnPost(DateTime? selectedDate, String? selectedCommittee)@(Html.Kendo().DateTimePicker()
.Name("SelectedDate")
.Value(Model.SelectedDate)
)
@(Html.Kendo().ComboBox()
.Name("SelectedCommittee")
.Value(Model.SelectedCommittee)
.DataTextField("ShortName")
.DataValueField("CommitteeId")
.AutoBind(true)
.HtmlAttributes(new { style = "width:50%;padding-left:25%;" })
.Events( e => e
.Select(@<text>
function() {
$("form").submit();
}
</text>)
)
.DataSource(ds =>
{
ds.Ajax()
.ServerOperation(true)
.Read(r => r.Url("/Availability/ClassesForTerm?handler=Read").Data("forgeryToken"));
}
)
)
</form>
{
SelectedDate = selectedDate;
SelectedCommittee = selectedCommittee;