コード例 #1
0
ファイル: Api.cs プロジェクト: fjgandrade/sharpkit
        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);
        }
コード例 #2
0
ファイル: Api.cs プロジェクト: fjgandrade/sharpkit
        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()));
        }
コード例 #3
0
ファイル: Api.cs プロジェクト: fjgandrade/sharpkit
        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()));
        }