Hi Team,
I am trying to create simple upload section using code shared further down, but it gives me below error saying validation is not defined error.
'Kendo.Mvc.UI.Fluent.UploadBuilder' does not contain a definition for 'Validation' and no extension method 'Validation' accepting a first argument of type 'Kendo.Mvc.UI.Fluent.UploadBuilder' could be found (are you missing a using directive or an assembly reference?)
I tried putting below in view but not fixed, not sure where this method comes from. Do i need to upgrade dll version as of now i am using 2014.3.1119.
@using Kendo.Mvc.Extensions;
Please suggest what i am missing. thanks.
@(Html.Kendo().Upload()
.Name("documentUploader")
.Messages(m => m.Select("Browse").UploadSelectedFiles("Upload"))
.Events(events =>
events.Success("uploadSuccess")
.Complete("uploadComplete")
.Error("onError")
.Upload("uploadClick")
)
.Multiple(false)
.Async(a => a
.Save("UploadDocument", "Document")
.AutoUpload(false)
.SaveField("uploadedDocuments")
)
.Validation(validation => validation.AllowedExtensions(new string[] { ".zip", ".rar" }).MaxFileSize(3145728)))
Hello,
Is there any way to force a script (javascript/jquery) to wait for the Grid sync to complete?
OR any way to retrieve the grid's model with data so as to perform a last update manually?
Currently due to timing with the async calls:
$("#Grid").data("kendoGrid").saveChanges();
OR
$("#OfficerGrid").data().kendoGrid.dataSource.sync();
There is data-loss when navigating to another page if it is done too soon after these calls are made.
I have setup and stepped through the existing event calls for both the grid (http://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/GridEventBuilder) and datasource (http://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/DataSourceEventBuilder).
All around it seems the DataSource .Sync() event is the last one triggered.
Here is the definition for the Grid:
@(Html.Kendo().Grid<NexusPWI.ViewModels.Wizard.ReportingViewModel>()
.Name("Grid")
.Columns(c =>
{
c.Bound(vm => vm.FirstName).Width(120);
c.ForeignKey(vm => vm.LocationNumber, (System.Collections.IEnumerable)ViewData["LocationsList"], "LocationNumber", "Drop_Text").HtmlAttributes(new { onchange = "triggerDropChange(this);" }).Width(100).Hidden(Model.Locations_ColumnInitHidden);
c.Bound(vm => vm.State).Width(120);
c.Command(command => { command.Destroy(); }).Width(40);
c.Template(@<text></text>);//Blank Column to handle Scrollable variable width so headers do not skew
})
.Scrollable(s => s.Enabled(true).Height("auto"))//Scrollable to control column widths
.ToolBar(toolbar =>
{
toolbar.Template("<div class='col-lg-3'>" +
"<a class='pull-right k-button k-button-icontext k-grid-save-changes' href='javascript:void(0)'><span class='k-icon k-update'></span>Save All</a>" +
"<a class='pull-right k-button k-button-icontext k-grid-add' href='/Wizard/EmployeePayrollRead?EmployeeGrid-mode=insert'><span class='k-icon k-add'></span>Add Row</a>" +
"</div>");
})
.Editable(editable => editable.Mode(GridEditMode.InCell)
.CreateAt(GridInsertRowPosition.Bottom)
)
.Navigatable()
.Pageable()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Events(events => events.Error("employeeGrid_error")
.RequestEnd("Grid_RequestEnd")
.Change("Grid_Delete")
.Sync("sendEnable")
)
.Model(model => model.Id(vm => vm.PolicyHolderPayroll_EmployeeGridId))
.PageSize(1000)
.Create("EmployeePayrollCreate", "Wizard")
.Read("EmployeePayrollRead", "Wizard")
.Update("EmployeePayrollUpdate", "Wizard")
.Destroy("EmployeePayrollDestroy", "Wizard")
))
With a call to navigate and save:
<a class='k-button k-button-icontext k-grid-save-changes pull-right' href='javascript:save_Grids_n_Move()'><span class='k-icon k-update'></span>Save All</a>
<script>
function save_Grids_n_Move() {
var Grid_save = $("#Grid").data().kendoGrid;
Grid_save.dataSource.sync();
element.closest("form").each(function () {
var form = $(this);
form.attr("action", action);
form.submit();
});
}
</script>
When editing an event that has already occurred and not to recur again, the user should be able to see the Edit window but have everything disabled and read-only for viewing the details of the event but not allowed to make changes or save.
What I have so far is after the logic for determining the event has ended and never to recur again to add the "k-state-disabled" class and set the pointer-events style to none so all controls in the k-edit-form-container are not clickable. This encompasses the entire edit window rather than explicitly disabling each and every control:
function
onEdit(e) {
// custom logic...
// if disabling editing then
// * add telerik disabled class to show all controls as disabled
// * set pointer-events style to prevent the controls from being active
if
(disableEditing) {
$(
'.k-edit-form-container'
).addClass(
"k-state-disabled"
).css(
"pointer-events"
,
"none"
);
}
}
The only issue is the k-edit-form-container also includes the save and cancel buttons as well so the only way for the Edit form to be closed is the 'X' in the upper/right. This causes a lot of confusion for our users since they do not initially understand the only way to close the window is the X and they often get "stuck" not knowing how to close it.
Is there a more recommended way to disable the edit window to display read-only and also presenting a "Close" button? I am using a customized template editor.
Hi. I'm trying to use the grid to display some data which a user is supposed to change. The problem is that so far I have been unsuccessful in making the grid update/edit or delete, nothing happens when I click the "Save" button. Or when I press enter. It just doesn't hit the controller when I set a break point. If I create or read, it works fine.
To create the project I did the following
My versions are:
* jQuery 1.10.2
* KendoUI 2014.1.415
* Bootstrap 3.0.0.0
* MVC 5.1.0.0
ManageWorkPlacements.cshtml
01.
@(Html.Kendo().Grid<
WorkPlacementModel
>()
02.
.Name("Grid")
03.
.Columns(columns =>
04.
{
05.
columns.Bound(p => p.Name);
06.
columns.Bound(p => p.CvrNumber);
07.
columns.Command(command => command.Destroy()).Width(110);
08.
})
09.
.ToolBar(toolbar =>
10.
{
11.
toolbar.Create();
12.
toolbar.Save();
13.
})
14.
.Editable(editable => editable.Mode(GridEditMode.InCell))
15.
.Pageable()
16.
.Navigatable()
17.
.Sortable()
18.
.Scrollable()
19.
.DataSource(dataSource => dataSource
20.
.Ajax()
21.
.Batch(true)
22.
.PageSize(20)
23.
.ServerOperation(false)
24.
.Events(events => events.Error("error_handler"))
25.
.Model(model => model.Id(p => p.Id))
26.
.Create("WorkPlacement_Create", "WorkPlacement")
27.
.Read("WorkPlacement_Read", "WorkPlacement")
28.
.Update("WorkPlacement_Update", "WorkPlacement")
29.
.Destroy("WorkPlacement_Destroy", "WorkPlacement")
30.
)
31.
)
32.
<
script
type
=
"text/javascript"
>
33.
function error_handler(e) {
34.
if (e.errors) {
35.
var message = "Errors:\n";
36.
$.each(e.errors, function (key, value) {
37.
if ('errors' in value) {
38.
$.each(value.errors, function () {
39.
message += this + "\n";
40.
});
41.
}
42.
});
43.
alert(message);
44.
}
45.
}
46.
</
script
>
01.
using
System;
02.
using
System.Collections.Generic;
03.
using
System.Linq;
04.
using
System.Web;
05.
using
System.Web.Mvc;
06.
using
Kendo.Mvc.Extensions;
07.
using
Kendo.Mvc.UI;
08.
using
RegistreringMVC.Migrations;
09.
using
RegistreringMVC.Models;
10.
using
RegistreringMVC.Services;
11.
12.
namespace
RegistreringMVC.Controllers
13.
{
14.
public
class
WorkPlacementController : Controller
15.
{
16.
private
WorkPlaceService workPlacementService;
17.
18.
public
WorkPlacementController()
19.
{
20.
workPlacementService =
new
WorkPlaceService(
new
RegistreringEntities());
21.
}
22.
23.
public
ActionResult WorkPlacement_Read([DataSourceRequest] DataSourceRequest request)
24.
{
25.
return
Json(workPlacementService.Read().ToDataSourceResult(request));
26.
}
27.
28.
[AcceptVerbs(HttpVerbs.Post)]
29.
public
ActionResult WorkPlacement_Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix =
"models"
)]IEnumerable<WorkPlacementModel> workPlacements)
30.
{
31.
var results =
new
List<WorkPlacementModel>();
32.
33.
if
(workPlacements !=
null
&& ModelState.IsValid)
34.
{
35.
foreach
(var workPlacement
in
workPlacements)
36.
{
37.
workPlacementService.Create(workPlacement);
38.
}
39.
}
40.
41.
return
Json(results.ToDataSourceResult(request, ModelState));
42.
}
43.
44.
[AcceptVerbs(HttpVerbs.Post)]
45.
public
ActionResult WorkPlacement_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix =
"models"
)]IEnumerable<WorkPlacementModel> workPlacements)
46.
{
47.
if
(workPlacements !=
null
&& ModelState.IsValid)
48.
{
49.
foreach
(var workPlacement
in
workPlacements)
50.
{
51.
workPlacementService.Update(workPlacement);
52.
}
53.
}
54.
55.
return
Json(workPlacements.ToDataSourceResult(request, ModelState));
56.
}
57.
58.
[AcceptVerbs(HttpVerbs.Post)]
59.
public
ActionResult WorkPlacement_Destroy([DataSourceRequest] DataSourceRequest request, [Bind(Prefix =
"models"
)]IEnumerable<WorkPlacementModel> workPlacements)
60.
{
61.
if
(workPlacements.Any())
62.
{
63.
foreach
(var workPlacement
in
workPlacements)
64.
{
65.
workPlacementService.Destroy(workPlacement);
66.
}
67.
}
68.
69.
return
Json(workPlacements.ToDataSourceResult(request, ModelState));
70.
}
71.
}
72.
}
I am using the grid in an MVC environment. I am trapping the Save event as follows:
.Events(events => events.Change("gridRowChange").Edit("onEdit").Save("onSave"))
Is there an event I can trap that fires after the save has been completed and successful?
Hy,
I created a
Spreadsheet. But I want to add a class to the SpreadsheetSheetRowCell Value attribute.
The cell only shows me [object Object] in the view. I tried to override the toString method
but with no effect.
As an
example if my class looks like:
public class User
{
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
How can I display the
first and the last name?
Thx for Help!
Hi,
I am currently using a Grid with a SignalR datasource and expandable rows to show a Detail Template, every time a new record is created in the grid from the server (onPush) it collapses any/all detail templates which you may have been viewing. Kinda annoying, any way to resolve this?
@(Html.Kendo().Grid<Models.MyView>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Column1);
columns.Bound(p => p.Column2);
})
.ClientDetailTemplateId("template")
.Sortable()
.Scrollable(s => s.Height("auto"))
.Filterable()
.Pageable()
.Navigatable()
.DataSource(dataSource => dataSource
.SignalR()
.AutoSync(true)
.ServerFiltering(true)
.ServerPaging(true)
.ServerSorting(true)
.ServerAggregates(true)
.ServerGrouping(true)
.PageSize(20)
.Events(events => events.Push("onPush"))
.Sort(s => s.Add("Posted").Descending())
.Transport(tr => tr
.Promise("hubStart")
.Hub("hub")
.Client(c => c
.Read("read")
.Create("create")
.Update("update")
.Destroy("destroy")
)
.Server(s => s
.Read("read")
.Create("create")
.Update("update")
.Destroy("destroy")
)
)
.Schema(schema => schema
.Data("Data")
.Total("Total")
.Aggregates("Aggregates")
.Groups("Groups")
.Model(model =>
{
model.Id("ID");
model.Field("Column1", typeof(string));
model.Field("Column2", typeof(string));
})
)
)
)
<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip()
.Name("tabStrip_#=ID#")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("Detail")
.LoadContentFrom("Detail", "Home", new { ID= "#=ID#" })
.Selected(true);
})
.ToClientTemplate())
</script>
Thanks!
I have an MVC grid with the following settings:
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Navigatable()
When the user is editing a row, I need to be able to trap when he/she leaves a particular cell so that I can perform a lookup on the value of the cell and place a default value in another cell.
How can I capture the event that occurs when a user leaves a cell?
Hello,
I have a startTime and a endTim on my Scheduler: from 7 AM to 16PM and I wonder if It's possible to hide one hour from 12 pm to 13pm.
@(Html.Kendo().Scheduler<KendoSchedulerMVC.Controllers.TAS_TasksViewModel>()
.Name("scheduler")
.Timezone("Etc/UTC")
.Date(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day))
.Height(800)
.StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
.EndTime(new DateTime(2013, 6, 13, 16, 00, 00))
.Editable(editable => editable
.EditRecurringMode(SchedulerEditRecurringMode.Dialog)
)
.Selectable(false)
.Views(views => {
views.DayView();
views.WorkWeekView();
views.WeekView(w => w.Selected(true));
views.MonthView();
views.AgendaView();
})
.DataSource(d => d
.Model(m => {
m.Id(f => f.tas_id);
m.Field(f => f.Title).DefaultValue("No title");
m.RecurrenceId(f => f.RecurrenceID);
})
.Read(read => read.Action("TAS_Tasks_Read", "Scheduler"))
.Create(create => create.Action("TAS_Tasks_Create", "Scheduler"))
.Update(update => update.Action("TAS_Tasks_Update", "Scheduler"))
.Destroy(destroy => destroy.Action("TAS_Tasks_Destroy", "Scheduler"))
)
)
Thank you