or


protected void RadGridInventory_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.ExportToExcelCommandName || e.CommandName == RadGrid.ExportToCsvCommandName) { RadGridInventory.PageSize = RadGridInventory.MasterTableView.VirtualItemCount; } if (e.CommandName == RadGrid.ExportToExcelCommandName) { var headerItem = (GridHeaderItem)RadGridInventory.MasterTableView.GetItems(GridItemType.Header)[0]; headerItem.Visible = true; isExport = true; } if (e.CommandName == RadGrid.ExportToCsvCommandName) { RadGridInventory.MasterTableView.GetColumn("CSVAcountId").Display = true; RadGridInventory.MasterTableView.GetColumn("AccountId").Display = false; RadGridInventory.MasterTableView.GetColumn("CSVStatus").Display = true; RadGridInventory.MasterTableView.GetColumn("Status").Display = false; } }protected void RadGridInventory_GridExporting(object source, GridExportingArgs e) { if (e.ExportType == ExportType.Excel) { string customText = "<h1 style='text-align:center;'>Inventory Report for " + _applicationUser.Customer.Name + "</h1>"; customText += "<p style='text-align:center;'><b>Current Date:</b> " + DateTime.Now + "<br />"; if(RadDatePickerStarting.SelectedDate != null && RadDatePickerEnding.SelectedDate != null){ customText += "<b>Date Range Covered:</b> " + RadDatePickerStarting.SelectedDate + " - " + RadDatePickerEnding.SelectedDate + "<br />"; } else { customText += "<b>Date Range Covered:</b> " + RadComboBoxChoices.SelectedItem.Text + "<br />"; } customText += "<b>Clients:</b>"; foreach (var client in ClientSelector1.SelectedClients) { customText += " " + client.Name + ","; } customText = customText.TrimEnd(','); customText += "</p>"; e.ExportOutput = e.ExportOutput.Replace("<body>", "<body>" + customText); } isExport = false; }<script type="text/javascript"> function onRequestStart(sender, args) { if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 || args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) { args.set_enableAjax(false); } } function onCommand(sender, args) { } </script>
@using InnovareClinicianDesktop.Areas.Admin.ViewModels@model InnovareClinicianDesktop.Areas.Admin.ViewModels.CompanyViewModelResults @{ ViewBag.Title = "Details";}<h2>Manage records in the Company table.</h2><div id="example" class="k-content"> @RenderCompanyViewModel()</div><h1>Other options:</h1>@Html.ActionLink("Return to Application Management", "Index", "Home")@helper RenderCompanyViewModel(){ @(Html.Kendo().Grid<CompanyViewModel>(Model.CompanyViewModels) .Name("grid") .Columns(columns => { columns.Bound(p => p.CompanyName).Width(127); columns.Bound(p => p.IsActive).Width(40); columns.Bound(p => p.CreatedDate).Width(80).Format("{0:MM/dd/yyyy}"); columns.Bound(p => p.CreatedBy).Width(80); columns.Bound(p => p.LastModifiedDate).Width(80).Format("{0:MM/dd/yyyy}"); columns.Bound(p => p.LastModifiedBy).Width(80); columns.Command(command => { command.Edit(); command.Destroy(); }).Width(160); }) .ToolBar(toolbar => toolbar.Create()) .Editable(editable => editable.Mode(GridEditMode.PopUp)) .Pageable(pageable => pageable .Refresh(true) .PageSizes(true) .ButtonCount(5)) .Sortable(sortable => sortable .AllowUnsort(true) .SortMode(GridSortMode.MultipleColumn)) .Scrollable() .ClientDetailTemplateId("template") .Resizable(resize => resize.Columns(true)) .Selectable(sel => sel.Mode(GridSelectionMode.Single)) .HtmlAttributes(new { style = "height:530px;" }) .DataSource(dataSource => dataSource .Ajax() .Events(events => events.Error("error_handler")) .Model(model => { model.Id(p => p.CompanyID); model.Field(p => p.CompanyID).DefaultValue(System.Guid.Empty); }) .Create(create => create.Action("EditingPopup_Create", "Company", new { area = "Admin" })) .Read(read => read.Action("EditingPopup_Read", "Company", new { area = "Admin" })) .Update(update => update.Action("EditingPopup_Update", "Company", new { area = "Admin" })) .Destroy(update => update.Action("EditingPopup_Destroy", "Company", new { area = "Admin" })) ) )}<script id="template" type="text/kendo-tmpl"> @(Html.Kendo().TabStrip() .Name("tabStrip_#=CompanyID#") .SelectedIndex(0) .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In))) .Items(items => { items.Add().Text("Users").Content(@<text> @(Html.Kendo().Grid<InnovareClinicianDesktop.Areas.Admin.ViewModels.ApplicationObjectViewModel>() .Name("applicationObject_#=CompanyID#") .Columns(columns => { columns.Bound(u => u.ObjectID).Title("ID").Width(56); columns.Bound(u => u.ObjectName).Width(110); columns.Bound(u => u.ObjectType).Width(30); columns.Bound(u => u.FirstName).Width(190); columns.Bound(u => u.LastName).Width(40); columns.Bound(u => u.EmailAddress).Width(160); columns.Bound(u => u.CreatedDate).Width(80).Format("{0:MM/dd/yyyy}"); columns.Bound(u => u.CreatedBy).Width(160); }) .ToolBar(toolbar => { toolbar.Custom().Text("Manage Users").Name("manageApplications").Action("Index", "ApplicationObject", new { companyID = "#=CompanyID#" }); }) .Pageable(pageable => pageable .Refresh(true) .PageSizes(true) .ButtonCount(5)) .Sortable(sortable => sortable .AllowUnsort(true) .SortMode(GridSortMode.MultipleColumn)) .Scrollable() .Resizable(resize => resize.Columns(true)) .Selectable(sel => sel.Mode(GridSelectionMode.Single)) .DataSource(dataSource => dataSource .Ajax() .PageSize(5) .Read(u => u.Action("ToolbarTemplate_ApplicationObjects", "Company", new { companyID = "#=CompanyID#" })) ) .ToClientTemplate()) </text> ); items.Add().Text("Applications").Content(@<text> @(Html.Kendo().Grid<InnovareClinicianDesktop.Areas.Admin.ViewModels.CompanyApplicationViewModel>() .Name("companyApplication_#=CompanyID#") .Columns(columns => { columns.Bound(a => a.CompanyApplicationID).Title("ID").Width(56); columns.Bound(a => a.ApplicationID).Width(110); columns.Bound(a => a.IsActive).Width(30); columns.Bound(a => a.CreatedBy).Width(160); columns.Bound(a => a.CreatedDate).Width(80).Format("{0:MM/dd/yyyy}"); columns.Bound(a => a.LastModifiedBy).Width(160); columns.Bound(a => a.LastModifiedDate).Width(80).Format("{0:MM/dd/yyyy}"); }) .ToolBar(toolbar => { toolbar.Custom().Text("Manage Applications").Name("manageApplications").Action("Index", "CompanyApplication", new { companyID = "#=CompanyID#" }); }) .Pageable(pageable => pageable .Refresh(true) .PageSizes(true) .ButtonCount(5)) .Sortable(sortable => sortable .AllowUnsort(true) .SortMode(GridSortMode.MultipleColumn)) .Scrollable() .Resizable(resize => resize.Columns(true)) .Selectable(sel => sel.Mode(GridSelectionMode.Single)) .DataSource(dataSource => dataSource .Ajax() .PageSize(5) .Read(a => a.Action("ToolbarTemplate_CompanyApplications", "Company", new { companyID = "#=CompanyID#" })) ) .ToClientTemplate()) </text> ); items.Add().Text("Modules").Content(@<text> @(Html.Kendo().Grid<InnovareClinicianDesktop.Areas.Admin.ViewModels.CompanyModuleViewModel>() .Name("companyModule_#=CompanyID#") .Columns(columns => { columns.Bound(m => m.CompanyModuleID).Title("ID").Width(56); columns.Bound(m => m.IsActive).Width(30); columns.Bound(m => m.CreatedBy).Width(160); columns.Bound(m => m.CreatedDate).Width(80).Format("{0:MM/dd/yyyy}"); columns.Bound(m => m.LastModifiedBy).Width(160); columns.Bound(m => m.LastModifiedDate).Width(80).Format("{0:MM/dd/yyyy}"); columns.Bound(m => m.ModuleID).ClientTemplate("<a href='" + Url.Action("Index", "CompanyModuleAppRole") + "?moduleID=" + "#= item.MethodID #" + "'>Manage Roles</a>").Width(100); }) .ToolBar(toolbar => { toolbar.Custom().Text("Manage Modules").Name("manageModules").Action("Index", "CompanyModule", new { companyID = "#=CompanyID#" }); }) .Pageable(pageable => pageable .Refresh(true) .PageSizes(true) .ButtonCount(5)) .Sortable(sortable => sortable .AllowUnsort(true) .SortMode(GridSortMode.MultipleColumn)) .Scrollable() .Resizable(resize => resize.Columns(true)) .Selectable(sel => sel.Mode(GridSelectionMode.Single)) .DataSource(dataSource => dataSource .Ajax() .PageSize(5) .Read(m => m.Action("ToolbarTemplate_CompanyModules", "Company", new { companyID = "#=CompanyID#" })) ) .ToClientTemplate()) </text> ); }) .ToClientTemplate())</script><script> function dataBound() { this.expandRow(this.tbody.find("tr.k-master-row").first()); }</script><script type="text/javascript"> function error_handler(e) { if (e.errors) { var message = "Errors:\n"; $.each(e.errors, function (key, value) { if ('errors' in value) { $.each(value.errors, function () { message += this + "\n"; }); } }); alert(message); } } function onComplete(e) { if (e.name == "Delete") { var result = e.response.result; if (result == true) $("#Items").data("tGrid").rebind(); else { alert("Error on deleting") } } }</script>