@model Smartrail.UI.ViewModels.DisplayPanelViewModel<div id="columnsList" style="height: 110px; overflow: auto;border:solid; width:150px;"> @if (Model.Columns != null) { foreach (var column in Model.Columns) { var checkBoxId = "chk" + column.Id; var tdId = "td" + column.Id; <table width="100%"> <tr > <td width="20px"> <input type="checkbox" id="@checkBoxId" value="@column.Id" /> </td> <td id="@tdId" width="100px"> @column.ColumnCode </td> </tr> </table> } }</div>Object reference not set to an instance of an object.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error: Line 4: Line 5: <div id="columnsList" style="height: 110px; overflow: auto;border:solid; width:150px;">Line 6: @foreach (var names in Model.Columns)Line 7: {Line 8: var checkBoxId = "chk" + names.Id;Source File: d:\Dev\Accutrak\Smartrail02\SourceCode\trunk\SmartrailWeb\Areas\DisplayPanel\Views\Setup\_ColumnsTab.cshtml Line: 6function onDataBound(e) { var grid = $("#Software").data("kendoGrid"); var gridData = grid.dataSource.view(); for (var i = 0; i < gridData.length; i++) { var currentUid = gridData[i].uid; if (gridData[i].CategoryID == 1) { var currenRow = grid.table.find("tr[data-uid='" + currentUid + "']"); $(currenRow).addClass("green"); } else if (gridData[i].CategoryID == 2 ){ var currenRow = grid.table.find("tr[data-uid='" + currentUid + "']"); $(currenRow).addClass("red"); } else { var currenRow = grid.table.find("tr[data-uid='" + currentUid + "']"); $(currenRow).addClass("yellow"); } }}function SetGreen(sid, cid) { var grid = $("#grid").data("kendoGrid"); cid =1; var url = '@Url.Action("SetMethod","SetController")'; $.post(url, { SID: sid, CID: cid }); grid.saveChanges(); //right here I want to set the bg color for the affected row}[CompareValues("PEEP", CompareValues.GreatThanOrEqualTo, ErrorMessageResourceName = "MAPGreaterThanPEEP", ErrorMessageResourceType = typeof(VentSettingStrings))]public decimal? MAP { get; set; }@(Html.Kendo().ListView<VentSetting>(Model.VentSettingsList) .Name("listView") .TagName("div") .ClientTemplateId("ventTemplate") .Editable() .DataSource(datasource => datasource .Events(events => events.Error("handleError")) .Model(model => model.Id(m => m.VentSettingId)) .Read(read => read.Action("ReadVentSettings", "RunDetail")) .Create(create => create.Action("CreateVentSetting", "RunDetail")) .Update(update => update.Action("UpdateVentSetting", "RunDetail")) .Destroy(destroy => destroy.Action("DeleteVentSetting", "RunDetail")) ))@using ELSORegistry.Helpers@using Kendo.Mvc.UI@model ELSORegistry.Areas.ECLS.Models.VentSetting<div style="padding:10px"> <span>@Html.LabelWithTooltipFor(model => model.MAP)</span> <span>@Html.TextBoxFor(model => model.MAP, new { @class = "k-textbox", style = "width:50px"})</span> <div class="edit-buttons"> <a class="k-button k-button-icontext k-update-button"><span class="k-icon k-update"></span>Save</a> <a class="k-button k-button-icontext k-cancel-button"><span class="k-icon k-cancel"></span>Cancel</a> </div>
</div>$(function () { var listView = $("#listView").data("kendoListView"); $(".k-add-button").click(function (e) { listView.add(); e.preventDefault(); });});function handleError(args) { if (args.errors) { var list = $("#listView").data("kendoListView"); var validationTemplate = kendo.template($("#validationMessageTemplate").html()); list.one("dataBinding", function (e) { e.preventDefault(); $.each(args.errors, function (propertyName) { var renderedTemplate = validationTemplate({ field: propertyName, messages: this.errors }); document.getElementById("errorList").innerHTML += renderedTemplate; }); }); }};Hi,
The attached sample project is based on your combo box sample post along with other elements.
In this project combo box onchange event does not fired if it has numeric value. Below are details for the same.
1. I have 2 combo boxes and 1 label in the attached project: Alphabet Combo, Numeric Combo and Selected Value: Alphabet Combo has values: A-1, B-2, C-3, D-4 and Number Combo has values: 1-A, 2-B, 3-C, 4-D
2. Select Alphabet combo by pressing letter 'A' or 'B' or 'C' or 'D' by using keyboard, onchange event fired and selected value and selected text will show on label control (working fine)
3. But I have done for Numeric Combo same as above, but it won't show selected value and selected text due to onchange event does not fired.
For testing,
- Alphabet Combo: Press 'A' by using keyboard and press Tab, it will show the selected value and text
- Numberic Combo: Press '1' by using keyboard and press Tab, it wont show the selected value and text
Code for above requirement:
1) Alphabet Combo:
@(Html.Kendo().ComboBox()
.Name("AlphabetCombo")
.Suggest(true)
.Filter("StartsWith").MinLength(0)
.HighlightFirst(true)
.Placeholder("Select fabric...")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>() {
new SelectListItem() {
Text = "Select", Value = "0"
},
new SelectListItem() {
Text = "A-1", Value = "1"
},
new SelectListItem() {
Text = "B-2", Value = "2"
},
new SelectListItem() {
Text = "C-3", Value = "3"
},
new SelectListItem() {
Text = "D-4", Value = "4"
}
})
.SelectedIndex(0)
.Events(events =>
{
events.Change("Combo_Change");
})
)
2) Numeric Combo:
@(Html.Kendo().ComboBox()
.Name("SampleData2")
.Suggest(true)
.Filter("StartsWith").MinLength(0)
.HighlightFirst(true)
//.Placeholder("Select fabric...")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>() {
new SelectListItem() {
Text = "Select", Value = "0"
},
new SelectListItem() {
Text = "1-A", Value = "1"
},
new SelectListItem() {
Text = "2-B", Value = "2"
},
new SelectListItem() {
Text = "3-C", Value = "3"
},
new SelectListItem() {
Text = "4-D", Value = "4"
}
})
.SelectedIndex(0)
.Events(events =>
{
events.Change("Combo_Change");
})
)
3) Label to show selected value and text
<b>Selected Value is : </b> <label id="lblSelectedValue" runat="server"></label>
4) OnChange Event: JavaScript code
<script language="javascript" type="text/javascript">
function Combo_Change(e) {
var combo = e.sender;
$('#lblSelectedValue').text(combo.value() + ', ' + combo.text());
}
</script>
Please help me to resolve the issue. Thanks in advance.
.

// Grid column definitioncolumns.ForeignKey(b => b.OreSourceId, (System.Collections.IEnumerable)ViewData["OreSources"], "Id", "Description")// Foreign key editor template@using System.Collections@using Kendo.Mvc.UI@(Html.Kendo().DropDownList() .Name("OreSourceId") .DataTextField("Description") .DataValueField("Id") //.Value(Model) .SelectedIndex(0) .OptionLabel(">> Select <<") .BindTo((IEnumerable) ViewData["OreSources"]))// Filling of the ViewDatavar dbDataService = GetService<IDBDataService>();ViewData["OreSources"] = dbDataService.ToLookUp<OreSource>();$('#div').block({message: '<h1 style="color:blue;">אנא המתן...</h1><br><input type="button" value="CANCEL" onclick="cancelSemHours()"/>'});if (!Response.IsClientConnected){ Response.End();}