Я хочу использовать эту функцию Javascript "filterProduct". Я хочу использовать его для раскрытия кендо как:
@(Html.Kendo().DropDownList()
.Name("ReferenceValue") //The name of the dropdownlist is mandatory. It specifies the "id" attribute of the widget.
.DataTextField("ValidValue") //Specifies which property of the Product to be used by the dropdownlist as a text.
.DataValueField("ReferenceValidValueID") //Specifies which property of the Product to be used by the dropdownlist as a value.
.BindTo(Model)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetReferenceValidValue", "GetData").Data("filterProducts"); //Set the Action and Controller name
})
.ServerFiltering(true); //If true the DataSource will not filter the data on the client.
})
.SelectedIndex(0) //Select first item.
)
<script>
function filterProducts() {
return {
categories: $("#categories").val()
};
}
</script>
Но когда я нажимаю на раскрывающийся список, тогда одно исключение вызывается как,
ReferenceError: filterProducts is not defined
Пожалуйста, помогите мне в этом, как я могу использовать функцию Javascript.
Вы можете попробовать переместить тег сценария перед объявлением DropDownList.