Wednesday, 26 July 2017

Kendo MVC
RibbonMenu


@using Kendo.Mvc.UI
@(Html.Kendo().ToolBar()
    .Name("ToolBar")
    .Items(items =>
    {
        //items.Add().Type(CommandType.Button).Click("homebtn").Id("btn_Home").ImageUrl(Url.Content("~/images/icon/home.png")).HtmlAttributes(new { @title = "Home" });
        items.Add().Type(CommandType.Button).Id("btn_new").ImageUrl(Url.Content("~/images/icon/add_new.png")).HtmlAttributes(new { @title = "New" });//.Text("Add")
        items.Add().Type(CommandType.Button).Click("savebtn").Id("rbn_leadSave").ImageUrl(Url.Content("~/images/icon/save.png")).HtmlAttributes(new { @title = "Save" });//.Click("createbtn")
        items.Add().Type(CommandType.Button).Id("btn_Edit").ImageUrl(Url.Content("~/images/icon/Edit.png")).HtmlAttributes(new { @title = "Edit" });//.Click("createbtn")
        items.Add().Type(CommandType.Button).Id("btn_Delete").ImageUrl(Url.Content("~/images/icon/delete.png")).HtmlAttributes(new { @title = "Delete" });//.Text("Add")
        items.Add().Type(CommandType.Separator);
        items.Add().Type(CommandType.Button).Click("backbtn").Id("btn_backword").ImageUrl(Url.Content("~/images/icon/Back.png")).HtmlAttributes(new { @title = "Backward" });//.Text("Add")
        items.Add().Type(CommandType.Button).Click("forwardbtn").Id("btn_forword").ImageUrl(Url.Content("~/images/icon/Forward.png")).HtmlAttributes(new { @title = "Forward" });
        //items.Add().Type(CommandType.Separator);

        items.Add().Type(CommandType.Separator);
        items.Add().Type(CommandType.Button).Click("clearbtn").Id("btn_clear").ImageUrl(Url.Content("~/images/icon/clear.png")).HtmlAttributes(new { @title = "Clear" });
        //  items.Add().Type(CommandType.Button).Click("refreshbtn").Id("btn_Refresh").ImageUrl(Url.Content("~/images/Refress1.jpg")).HtmlAttributes(new { @title = "Refresh" });//.Text("Add")
        items.Add().Type(CommandType.Separator);
        items.Add().Type(CommandType.Button).Id("btn_upload").ImageUrl(Url.Content("~/images/icon/upload.png")).HtmlAttributes(new { @title = "Upload" });//.Text("Add")
        items.Add().Type(CommandType.Separator);
        items.Add().Template("<input id='dropdown' style='width: 160px;'  />").Overflow(ShowInOverflowPopup.Never);
        items.Add().Type(CommandType.Separator);
        items.Add().Type(CommandType.Button).Id("btn_Export").ImageUrl(Url.Content("~/images/icon/Export.png")).HtmlAttributes(new { @title = "Export" });
        items.Add().Type(CommandType.Button).Id("btn_Exportexcel").ImageUrl(Url.Content("~/images/icon/ExportExcel.png")).HtmlAttributes(new { @title = "Export Excel" });
        // items.Add().Type();
        items.Add().Type(CommandType.Button).Id("btn_print").ImageUrl(Url.Content("~/images/icon/printer.png")).HtmlAttributes(new { @title = "Print" });
        items.Add().Type(CommandType.Button).Id("btn_print").ImageUrl(Url.Content("~/images/icon/help.png")).HtmlAttributes(new { @title = "Help" });
        //  items.Add().Type(CommandType.Button).Click("editbtn").Id("btn_Edit").ImageUrl(Url.Content("~/images/Edit1.jpg"));//.Text("Add")


        //items.Add().Type(CommandType.Button).Click("logoutbtn").Id("btn_Delete").ImageUrl(Url.Content("~/images/icon/logout.png"));
        //items.Add().Template("<img src='" + Url.Content("~/images/Create1.jpg") + "' alt='add image' title='create' />");
        //items.Add().Type(CommandType.Separator);
        //items.Add().Template("<img src='" + Url.Content("~/images/Edit1.jpg") + "' alt='add image' title='Edit' />");
        //items.Add().Type(CommandType.Separator);
        // items.Add().Template("<img src='" + Url.Content("~/images/Refress1.jpg") + "' alt='add image' title='Refresh' />");
    })
        // .Events(e => e.Click("onClick").Toggle("onToggle").Open("onOpen").Close("onClose").OverflowOpen("onOverflowOpen").OverflowClose("onOverflowClose"))
)
@*@(Html.Kendo().AutoComplete()
                        .Name("kautocomplete1")
                        .MinLength(1)
                        .Placeholder("Select Customer")
                        .HtmlAttributes(new { style = "width:20%" })
                        .BindTo(new string[] { "Bulgaria", "USA", "India", "Australia", "UK" })
                        .Template("<span><img src='/images/${data}.jpg' " + " width='30' height='30' />&nbsp;${data}</span>")
                        .Filter(FilterType.Contains)
    )*@

<script>

    $(document).ready(function () {

        $("#dropdown").kendoDropDownList({
            optionLabel: "Select",
            dataTextField: "text",
            dataValueField: "value",
            dataSource: [
                { text: "A", value: 1 },
                { text: "B", value: 2 },
                { text: "C", value: 3 },
                { text: "D", value: 4 },
                { text: "E", value: 5 },
            ]
        });
    });

    function homebtn(e) {

        document.location.href = "localhost:2588/HRMSMain/Index";
        return;

    }

    //function savebtn(e) {
    //    alert('hgfhfgh');
    //    return;

    //}

    function editbtn(e)
    {
        alert(e.id);
        return;

    }

    function backbtn(e)
    {

        parent.history.back();
        return false;

    }
    function forwardbtn(e)
    {

        parent.history.forward();
        return true;

    }
    function clearbtn()
    {
        $(':input').each(function () {
            var type = this.type;
            var tag = this.tagName.toLowerCase();

            if (type == 'text' || type == 'password' || tag == 'textarea' || type == 'file')
                this.value = "";


            else if (type == 'checkbox' || type == 'radio')
                this.checked = false;

            else if (tag == 'select')
                this.selectedIndex = 0;
        });
    }
    function refreshbtn()
    {
       // document.location.reload();
        location.reload(true)
    }

    function deletebtn(e)
    {
        alert(e.id);

    }

</script>

////////////////////////////////////////////////////////////////////////

No comments:

Post a Comment