or
public static Kendo.Mvc.UI.Fluent.PanelBarBuilder MovementPanel(this HtmlHelper helper, string name, Boolean withContainer,string Controller, RouteValueDictionary export){ Kendo.Mvc.UI.Fluent.PanelBarBuilder myPanel = helper.Kendo().PanelBar() .Name(name) .ExpandAll(true) .ExpandMode(PanelBarExpandMode.Multiple); PanelBarItem itAction = new PanelBarItem(); itAction.Text = "Actions"; itAction.Items.Add(NewBarItem("Error detail","javascript:void(0)")); itAction.Items.Add(NewBarItem("File content", "javascript:void(0)")); PanelBarItem itExcel = new PanelBarItem(); itExcel.Text = "Excel export"; itExcel.Action("ExportToExcel", Controller, export); itAction.Items.Add(itExcel); if (withContainer) { itAction.Items.Add(NewBarItem("Container history", "javascript:void(0)")); } myPanel.ItemAction(ac => ac.Items.Add(itAction)); myPanel.Events(events => events.Select("OnSelectAction") ); return myPanel;}private static PanelBarItem NewBarItem(string text, string url){ PanelBarItem itTemp = new PanelBarItem(); itTemp.Text = text; itTemp.Url = url; return itTemp;}<script id="template" type="text/kendo-tmpl">@(Html.Kendo().Grid<ZakresViewModel>().Name("podzakresy#=IdZakres#").Editable(editable => editable.Mode(GridEditMode.PopUp)).ToolBar(toolbar =>{ toolbar.Create().Text("<span class=\"fa fa-plus\"></span> " + SettingsStrings.DodajNowyPodzakres).HtmlAttributes(new { @class = "btn btn-warning", idZakresNadrzedny = "#=IdZakres#" });}).Columns(columns =>{ columns.Bound(c => c.Numer).Width(80).Title(SharedStrings.Numer); columns.Bound(c => c.Nazwa).Title(SharedStrings.Nazwa); columns.Command(command => command.Edit().UpdateText(SharedStrings.Zapisz).CancelText(SharedStrings.Anuluj).Text(SharedStrings.Edytuj)).Width(100); columns.Command(command => command.Destroy().Text(SharedStrings.Usun)).Width(100);}).DataSource(dataSource => dataSource .Ajax() .PageSize(10) .Model(model => { model.Id(p => p.IdZakres); }) .Read(read => read.Action("GridPodzakresy_Read", "Settings", new { IdZakresNadrzedny = "#=IdZakres#" })) .Create(create => create.Action("GridPodzakresy_PopupCreate", "Settings", new { IdZakresNadrzedny = "#=IdZakres#" })) .Update(update => update.Action("GridZakresy_PopupUpdate", "Settings")) .Destroy(delete => delete.Action("GridZakresy_PopupDestroy", "Settings"))).Pageable().Selectable(selectable => selectable.Mode(GridSelectionMode.Single)).Sortable().ToClientTemplate())</script>@(Html.Kendo().Grid<ZakresViewModel>().Name("grid-zakresy").HtmlAttributes(new { style = "height:100%; cursor:default" }).ClientDetailTemplateId("template").Editable(editable => editable.Mode(GridEditMode.PopUp)).ToolBar(toolbar => toolbar.Create().Text("<span class=\"fa fa-plus\"></span> " + SettingsStrings.DodajNowyZakres).HtmlAttributes(new { @class = "btn btn-primary" })).Columns(columns =>{ columns.Bound(c => c.IdKontrakt).Visible(false).Filterable(false); columns.Bound(c => c.IdZakres).Visible(false).Filterable(false); columns.Bound(c => c.IdZakresNadrzedny).Visible(false).Filterable(false); columns.Bound(c => c.Numer).Width(80).Title(SharedStrings.Numer); columns.Bound(c => c.Nazwa).Title(SharedStrings.Nazwa); columns.Command(command => command.Edit().UpdateText(SharedStrings.Zapisz).CancelText(SharedStrings.Anuluj).Text(SharedStrings.Edytuj)).Width(100); columns.Command(command => command.Destroy().Text(SharedStrings.Usun)).Width(100);}).Pageable(pageable => pageable.Refresh(true).ButtonCount(3)).Sortable(s => { s.AllowUnsort(true); s.SortMode(GridSortMode.MultipleColumn); }).Scrollable(scr => { scr.Height("100%"); scr.Enabled(false); }).Selectable(selectable => selectable.Mode(GridSelectionMode.Single)).DataSource(dataSource => dataSource .Ajax() .PageSize(10) .Model(model => { model.Id(p => p.IdZakres); }) .Read(read => read.Action("GridZakresy_Read", "Settings", new { IdKontrakt = Model.IdKontrakt })) .Create(create => create.Action("GridZakresy_PopupCreate", "Settings")) .Update(update => update.Action("GridZakresy_PopupUpdate", "Settings")) .Destroy(delete => delete.Action("GridZakresy_PopupDestroy", "Settings"))))[AcceptVerbs(HttpVerbs.Post)]public ActionResult GridPodzakresy_PopupCreate([DataSourceRequest] DataSourceRequest request, ZakresViewModel zakres){ if (zakres != null && ModelState.IsValid) { //some code } return Json(new[] { zakres }.ToDataSourceResult(request, ModelState));}public class ExportData { public DateTime startDate { get; set; } public DateTime endDate { get; set; } public string exportType { get; set; } }@using Microsoft.AspNet.Identity@using Kendo.Mvc.UI@model InsulinCalculator.Models.ExportData@using (Html.BeginForm("Export", "Home", FormMethod.Post)){ <div class="form-group"> <label class="col-md-2 control-label" for="dtpStartDate" style="white-space:nowrap;">Start Date:</label> <div class="col-md-3"> <div class="input-group"> @(Html.Kendo() .DatePickerFor(model => model.startDate) .Name("dtpStartDate") .Format("MM/dd/yyyy") .HtmlAttributes(new { style = "width:180px" }) ) </div> </div> </div> <div class="form-group"> <label class="col-md-2 control-label" for="dtpEndDate" style="white-space:nowrap;">End Date:</label> <div class="col-md-3"> <div class="input-group"> @(Html.Kendo() .DatePickerFor(model => model.endDate) .Name("dtpEndDate") .Format("MM/dd/yyyy") .HtmlAttributes(new { style = "width:180px" }) ) </div> </div> </div> <div class="form-group"> <label class="col-md-2 control-label" for="exportType" style="white-space:nowrap;">Format:</label> <div class="col-md-3"> @(Html.Kendo() .DropDownListFor(model => model.exportType) .Name("exportType") .HtmlAttributes(new { style = "width:180px" }) .BindTo(new List<string>() { "Microsoft Excel (XLSX)", "Microsoft Word (DOCX)", "Adobe Acrobat (PDF)" }) ) </div> </div> <div class="form-group"> <div class="col-sm-4"> <input type="submit" value="Export Data" class="btn btn-sm bg-purple2 pull-right"> </div> </div>}[Authorize][HttpPost]public ActionResult Export(ExportData oData) { Response.Write(oData.startDate + " " + oData.endDate + " " + oData.exportType); return View();}
@{ Html.Kendo() .Grid<Teamnet.eViza.Model.Entities.App.DocumentData>() .Name("gridDocumentData") .Columns(columns => { columns.Bound(c => c.Id); columns.Bound(c => c.IssuedByAuthority); columns.Bound(c => c.IssuedCountry) .ClientTemplate("#=(IssuedCountry == null) ? '' : IssuedCountry.roDescription #") .EditorTemplateName("NomLookup"); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200); }) .DataSource(dataSource => { dataSource.Ajax() .CrudWithQueryAndDefaultCommands( new Teamnet.eViza.Business.Queries.AllEntitiesOfTypeName(typeof(Teamnet.eViza.Model.Entities.App.DocumentData)), "DocumentData") .AutomaticRefreshed(); dataSource.Ajax() .Model(model => model.Id(a => a.Id)); dataSource.Ajax().PageSize(10); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.InLine)) .AutoBind(true) .Pageable() .Filterable() .Sortable() .Render();}@model Teamnet.eViza.Model.Entities.BaseNom@(Html.Kendo().ComboBoxFor(a => a) .DataTextField("roDescription") .DataValueField("Id") .Filter(FilterType.StartsWith) .HighlightFirst(true) .MinLength(1) .DataSource(dataSource => dataSource.Read(read => read.Action("Read", "NomComboBox", new { nomType = Teamnet.eViza.WebCommon.Utils.TypeUtils.FullNameWithAssembly(ViewData.ModelMetadata.ModelType) }) ).ServerFiltering(true)) .SelectedIndex(0))