static void OnReady() { var data = new JsArray<DropDownListConfiguration> { new DropDownListConfiguration {text = "The Shawshank Redemption", value ="1"}, new DropDownListConfiguration {text = "The Godfather", value ="2"}, new DropDownListConfiguration {text = "The Godfather = Part II", value ="3"}, new DropDownListConfiguration {text = "Il buono, il brutto, il cattivo.", value ="4"}, new DropDownListConfiguration {text = "Pulp Fiction", value ="5"}, new DropDownListConfiguration {text = "12 Angry Men", value ="6"}, new DropDownListConfiguration {text = "Schindler's List", value ="7"}, new DropDownListConfiguration {text = "One Flew Over the Cuckoo's Nest", value ="8"}, new DropDownListConfiguration {text = "Inception", value ="9"}, new DropDownListConfiguration {text = "The Dark Knight", value ="10"} }; new jQuery("#products").kendoDropDownList(new DropDownListConfiguration { dataTextField = "text", dataValueField = "value", dataSourceObject = data }) .closest(".k-widget") .attr("id", "products_wrapper"); var dropdownlist = new jQuery("#products").data("kendoDropDownList").As<DropDownList>(); JsAction<Event> setValue = e => { if (e.type != "keypress" || Kendo.keys.ENTER == e.keyCode) dropdownlist.value(new jQuery("#value").val().As<JsString>()); }, setIndex = e => { if (e.type != "keypress" || Kendo.keys.ENTER == e.keyCode) { var index = int.Parse(new jQuery("#index").val().As<JsString>()); dropdownlist.select(index); } }, setSearch = e => { if (e.type != "keypress" || Kendo.keys.ENTER == e.keyCode) dropdownlist.search(new jQuery("#word").val().As<JsString>()); }; new jQuery("#enable").click(() => dropdownlist.enable()); new jQuery("#disable").click(() =>dropdownlist.enable(false)); new jQuery("#open").click(() => dropdownlist.open()); new jQuery("#close").click(() => dropdownlist.close()); new jQuery("#getValue").click(() => HtmlContext.window.alert(dropdownlist.value())); new jQuery("#getText").click(() => HtmlContext.window.alert(dropdownlist.text())); new jQuery("#setValue").click(setValue); new jQuery("#value").keypress(setValue); new jQuery("#select").click(setIndex); new jQuery("#index").keypress(setIndex); new jQuery("#find").click(setSearch); new jQuery("#word").keypress(setSearch); }
static void OnReady() { new jQuery("#editor").kendoEditor(); var editor = new jQuery("#editor").data("kendoEditor").As<Editor>(); JsAction setValue = () => editor.value(new jQuery("#value").val().As<JsString>()); new jQuery("#get").click(() => HtmlContext.window.alert(editor.value())); new jQuery("#set").click(setValue); }
static void OnReady() { // create ComboBox from input HTML element new jQuery("#input").kendoComboBox(new ComboBoxConfiguration { dataTextField = " text", dataValueField = "value", dataSourceObject = new JsArray<ComboBoxConfiguration> { new ComboBoxConfiguration { text = "Cotton", value = "1"}, new ComboBoxConfiguration { text = "Polyester", value = "2" }, new ComboBoxConfiguration{ text = "Cotton/Polyester", value = "3" }, new ComboBoxConfiguration{ text = "Rib Knit", value = "4" } }, filter = "contains", suggest = true, index = 3 }); // create ComboBox from select HTML element new jQuery("#select").kendoComboBox(); var input = new jQuery("#input").data("kendoComboBox").As<ComboBox>(); var select = new jQuery("#select").data("kendoComboBox").As<ComboBox>(); new jQuery("#get").click(() => HtmlContext.window.alert("Thank you! Your Choice is:\n\nFabric ID: " + input.value() + " and Size: " + select.value())); }
static void OnReady() { new jQuery("#numerictextbox").kendoNumericTextBox(); var numerictextbox = new jQuery("#numerictextbox").data("kendoNumericTextBox").As<NumericTextBox>(); JsAction setValue = () => numerictextbox.value(new jQuery("#value").val().As<JsString>()); new jQuery("#enable").click(() => numerictextbox.enable()); new jQuery("#disable").click(() => numerictextbox.enable(false)); new jQuery("#value").kendoNumericTextBox(new NumericTextBoxConfiguration { change = e=>setValue() }); new jQuery("#set").click(setValue); new jQuery("#get").click(() => HtmlContext.window.alert(numerictextbox.value())); }
static void OnReady() { new jQuery("#datepicker").kendoDatePicker() .closest(".k-widget") .attr("id", "datepicker_wrapper"); var datepicker = new jQuery("#datepicker").data("kendoDatePicker").As<DatePicker>(); JsAction setValue = () => datepicker.value(new jQuery("#value").val().As<JsString>()); new jQuery("#enable").click(() => datepicker.enable()); new jQuery("#disable").click(() => datepicker.enable(false)); new jQuery("#open").click(() => datepicker.open()); new jQuery("#close").click(() => datepicker.close()); new jQuery("#value").kendoDatePicker(new DatePickerConfiguration { change = setValue }); new jQuery("#set").click(setValue); new jQuery("#get").click(() => HtmlContext.window.alert(datepicker.value())); }
static void OnReady() { new jQuery("#calendar").kendoCalendar(); var calendar = new jQuery("#calendar").data("kendoCalendar").As<Calendar>(); calendar.value(new JsDate()); JsAction navigate = () => { var value = new jQuery("#direction").val().As<JsString>(); switch (value) { case "up": calendar.navigateUp(); break; case "down": calendar.navigateDown(calendar.value()); break; case "past": calendar.navigateToPast(); break; default: calendar.navigateToFuture(); break; }; }; JsAction setValue = () => calendar.value(new jQuery("#value").val().As<JsString>()); new jQuery("#get").click(() => HtmlContext.window.alert(calendar.value())); new jQuery("#value").kendoDatePicker(new DatePickerConfiguration { change = setValue }); new jQuery("#set").click(setValue); new jQuery("#direction").kendoDropDownList(new DropDownListConfiguration { change = navigate }); new jQuery("#navigate").click(navigate); }