Tuesday 11 March 2014

Kendo UI Tips

How to clear Kendo fields from javascript function:

    function ClearFields() {
        $('#Result').hide();//div
        $("# Subject ").val(''); //Kendo TextBox control
        $("#Importance").data("kendoDropDownList").value('-1'); //Kendo DropDownList control
        var editor = $("#Body").data("kendoEditor"); //Kendo Editor
        editor.value('');   
    }


How to set Kendo Dropdownlist values/text if we aren’t fetching from DB.
How to add the default (optional) field.

                  @(Html.Kendo().DropDownListFor(model => model.Importance)
                        .DataTextField("Text")
                        .DataValueField("Value")
                        .OptionLabel("-- Select --")
                        .BindTo(new List<SelectListItem>() {                               
                            new SelectListItem() {
                                Text = "NORMAL",
                                Value = "0"
                            },
                            new SelectListItem() {
                                Text = "PERSONAL",
                                Value = "1"
                            }

                        })



Will keep on adding to it with time...

No comments: