Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        static void OnReady()
        {
            new jQuery("#datetimepicker").kendoDateTimePicker()
                          .closest(".k-widget")
                          .attr("id", "datetimepicker_wrapper");
            
            var datetimepicker = new jQuery("#datetimepicker").data("kendoDateTimePicker").As<DateTimePicker>();
            
            JsAction setValue = () => datetimepicker.value(new jQuery("#value").val().As<JsString>());
            
            new jQuery("#enable").click(() => datetimepicker.enable());
            new jQuery("#disable").click(() => datetimepicker.enable(false));
            new jQuery("#openDateView").click(() => datetimepicker.open("date"));
            new jQuery("#openTimeView").click(() => datetimepicker.open("time"));
            new jQuery("#closeDateView").click(() => datetimepicker.close("date"));
            new jQuery("#closeTimeView").click(() => datetimepicker.close("time"));
            new jQuery("#value").kendoDateTimePicker(new DateTimePickerConfiguration
            {
                change = setValue
            });

            new jQuery("#set").click(setValue);
            new jQuery("#get").click(() => HtmlContext.window.alert(datetimepicker.value()));
        }