• HTML5 Web app开发工具Kendo UI Web教程:如何配置Kendo UI Calendar


        Kendo UI Web包含数百个创建HTML5 web app的必备元素,包括UI组件、数据源、验证、一个MVVM框架、主题、模板等。本文来看看如何配置Kendo UI Calendar。

    1、创建新的操作方法来显示视图:

    public ActionResult Index()
    {
        return View();
    }
    

    2、添加日历

    WebForms

    <%: Html.Kendo().Calendar()
        .Name("calendar") //The name of the calendar is mandatory. It specifies the "id" attribute of the widget.
        .Min(new DateTime(2010, 1, 1, 10, 0, 0)) //Set min time of the calendar
        .Max(new DateTime(2010, 1, 1, 20, 0, 0)) //Set min date of the calendar
        .Value(DateTime.Now) //Set the value of the calendar
    %>
    

    Razor

    @(Html.Kendo().Calendar()
        .Name("calendar") //The name of the calendar is mandatory. It specifies the "id" attribute of the widget.
        .Min(new DateTime(2010, 1, 1, 10, 0, 0)) //Set min time of the calendar
        .Max(new DateTime(2010, 1, 1, 20, 0, 0)) //Set min date of the calendar
        .Value(DateTime.Now) //Set the value of the calendar
    )
    

    访问Existing Calendar

    通过jQuery.data()引用一个现有日历实例,一旦建议了引用,就可以使用API来控制它的行为。

    访问现有日历实例

    //Put this after your Kendo Calendar for ASP.NET MVC declaration
    <script>
    $(function() {
    // Notice that the Name() of the calendar is used to get its client-side instance
    var calendar = $("#calendar").data("kendoCalendar");
    });
    </script>
    

    处理Kendo UI Calendar事件

    通过Kendo UI Calendar可以订阅所有的事件。

    WebForms -由处理程序名称订阅

    <%: Html.Kendo().Calendar()
        .Name("calendar")
        .Events(e => e
            .Change("calendar_change")
            .Navigate("calendar_navigate")
        )
    %>
    <script>
    function calendar_navigate() {
        //Handle the navigate event
    }
     
    function calendar_change() {
        //Handle the change event
    }
    </script>
    

    Razor -由处理程序名称订阅

    @(Html.Kendo().Calendar()
      .Name("calendar")
      .Events(e => e
            .Change("calendar_change")
            .Navigate("calendar_navigate")
      )
    )
    <script>
    function calendar_navigate() {
        //Handle the navigate event
    }
     
    function calendar_change() {
        //Handle the change event
    }
    </script>
    

    Razor -通过模板委托订阅

    @(Html.Kendo().Calendar()
      .Name("calendar")
      .Events(e => e
          .Change(@<text>
            function() {
                //Handle the change event inline
            }
          </text>)
          .Navigate(@<text>
            function() {
                //Handle the navigate event inline
            }
            </text>)
      )
    

    点击下载Kendo UI Web

  • 相关阅读:
    final 和 static
    EL表达式
    strusts2request,session取得
    Double的精度问题
    隐藏软件盘(个人因为好用的方法)
    ListView没有分割线怎么办?
    自定义ActionBar完全覆盖系统的
    保存图片的工具类
    Intent传递list<bean>集合
    Android取得图库图片的具体地址
  • 原文地址:https://www.cnblogs.com/elegant-dancer/p/3369682.html
Copyright © 2020-2023  润新知