My DropDownList
successfully binds to a ViewData
and populates the list correctly.
When the "OnChange" event is triggered, I want to capture the user's selection. However, despite my efforts, nothing seems to be happening.
<fieldset style="width: 300px;">
<legend>Change Vehicle</legend>
@{Html.Telerik().DropDownList()
.Name("UpdateVehicleTypeNumbers")
.BindTo((IEnumerable<DropDownItem>)ViewData["PlantItemsDropDown"])
.Enable(true)
.ClientEvents(events => events.OnChange("submitVehicle"))
.HtmlAttributes(
new { @id = "vehicle"})
.Render();
}
</fieldset>
I suspect there might be an error in the JavaScript code.
function submitVehicle(){
window.location = '../Operator/GPS?jobId=' + @the_job_id + '&vehicleId=' + $("#vehicle").val();
}