Hi,
I want to use my own Editor (PartialView) to edit row's from my Kendo MVC grid
(not use the build in template editing because off the limitations with the layout like save and cancel button location etc.)
attached you can see a Picture off my editing form (it uses i.e also Kendo Toolbar with save button...)
My question is: what is the best approach to implement this?
I have found two possibilities to solve this but not sure if these are good Solutions:
window.refresh({ url: "/Mitglied/Fachgruppenzugehoerig/_Edit/", data: { mitgliedid: dataitem.Mitglied_ID, berechtigungid: dataitem.Berechtigung_ID, sparteid: dataitem.Sparte_ID, fachgruppeid: dataitem.Fachgruppe_ID, fachgruppesubid: dataitem.FachgruppeSub_ID, fachgruppeversionid: dataitem.Fachgruppe_Version_ID, berufsgruppeid: dataitem.Berufsgruppe_ID, berufsgruppeversionid: dataitem.Berufsgruppe_Version_ID }in the partial view I use normal razor Syntax to bind to the model:
...<div><label class="col-sm-3 control-label">Rechtsw.datum:</label> <div class="col-sm-4"> @(Html.EditorFor(m => m.Rechtswirksamkeitsdatum, "")) @Html.ValidationMessageFor(model => model.Rechtswirksamkeitsdatum)</div>with this approach i have to refresh the grid after data changes...
2. Load the PartialView with the Kendo window and use "Kendo.bind" to bind the controls to the valus of the Kendo grid:
var grid = $("#grid").data("kendoGrid");var dataItem = grid.dataItem(grid.select());kendo.bind($('#externaleditor'), dataItem);here in the partial view I use different razor Syntax to bind to the grid values (see data_bind = "value: Rechtswirksamkeitsdatum") :
<label class="col-sm-3 control-label">Rechtsw.datum:</label> <div class="col-sm-4"> @(Html.TextBox("Rechtswirksamkeitsdatum", "", new { data_bind = "value: Rechtswirksamkeitsdatum", @class = "k-textbox" })) @Html.ValidationMessageFor(model => model.Rechtswirksamkeitsdatum) </div>
robert
We have a set up where we have a grid in a dialog and are trying to fire a simple action ...
So the end configuration on the dialog looks like this ..
.Actions(actions =>
{
actions.Add().Text("Cancel");
actions.Add().Text("OK").Primary(true).Action("onActionOK");
})
the function is a pretty simple one right now.. just trying to make sure it is hit
function onActionOK(e) {
console.log("actionOK event");
}
But this is never hit and there are no messages in the console.... is there an alternate way that I should be defining the action?
Thanks
AJ

@(Html.Kendo().Grid<MyModels.Models.ViewModels.ProductCategoryViewModel>() .Name("grid") .Columns(columns => { columns.Bound(p => p.ProductName); columns.Bound(p => p.Category).ClientTemplate("#=Category.CategoryName#").Width(160); columns.Bound(p => p.UnitPrice).Width(120); columns.Command(command => command.Destroy()).Width(90); }) .ToolBar(toolBar => { toolBar.Create(); toolBar.Save(); }) .Editable(editable => editable.Mode(GridEditMode.InCell)) .Pageable() .Sortable() .Scrollable() .HtmlAttributes(new { style = "height:430px;" }) .DataSource(dataSource => dataSource .Ajax() .Batch(true) .ServerOperation(false) .Events(events => events.Error("error_handler")) .Model(model => { model.Id(p => p.ProductID); model.Field(p => p.ProductID).Editable(false); }) .PageSize(20) .Read(read => read.Action("GetAllProductsAndRelatedCategories", "Product")) .Create(create => create.Action("AddProductsAndRelatedCategories", "Product")) .Update(update => update.Action("UpdateProductsAndRelatedCategories", "Product")) .Destroy(destroy => destroy.Action("RemoveProductsAndRelatedCategories", "Product")) ))
I have a Telerik MVC Grid with server binding. I configure it to have an 'all' page size option. The page size selection works and when I pick 'all' it does show all the records but the selected page size value in the dropdown resets to default. Is this a bug or I'm doing something wrong? Is there a workaround for this? I've attached an example project (excluded Kendo components from the archive).
Thank you.
Nik
I have a grid that has a command edit , I would like to retrieve the new text in the events.Save("onEdit")) javascript.
I cannot see how to do this, and cannot locate any samples in the forms.
My current function and grid is below. How can I retrieve the data from the email address when the update button is selected in edit more.
function onEdit(e) {
e.preventDefault();
alert("save 1");
var grid = $("#siteManagementNotifications").data("kendoGrid");
var tr = $(e.target).closest("tr");
var data = this.dataItem(tr);
alert(data.emailAddress);
}
@(Html.Kendo().Grid<WebSite.Library.Models.SiteNotifications>()
.Name("siteManagementNotifications")
.Columns(columns =>
{
columns.Bound(p => p.siteId).Title("Id").Width(50).Hidden();
columns.Bound(p => p.siteNotificationId).Title("Id").Width(50).Hidden();
columns.Bound(p => p.siteNotification).Title("Type").Width(50);
columns.Bound(p => p.emailAddress).Title("Notification").Width(120).EditorTemplateName("TextBoxEditor");
//columns.Command(command => command.Custom("Save").Click("SaveSiteNotification")).Width(180);
columns.Command(command => { command.Edit(); }).Width(250);
})
.Events(events => events.Save("onEdit"))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.NoRecords("No notifications exist.")
.DataSource(source => source
.Custom()
.Schema(schema => schema
.Model(m => m.Id(p => p.siteNotificationId)))
.Transport(transport => transport
.Read(read =>
{
read.Url("/Api/SiteInfo/_getNotifications/" + Model.SiteId)
.DataType("json");
})
))
)

I'm having trouble selecting the entire cell when editing a grid in InLine mode. I want the entire cell selected to make entering a new value easier.
I tried adding the onEdit event. But the onEdit event fires when the Edit button is clicked.
For grids that are batch edit, I've been able to have the onEdit event fire javascript to select the entire cell. This is how I'm doing it for a grid in batch mode. I assume it will be similar, but I'm struggling with it. Thanks for your help.
function onEdit(e) { var inputName = e.container.find('input').attr("name"); var myInput = e.container.find('input[name="' + inputName + '"]'); myInput.select(); }grid.dataSource.transport.options.read.url = "addr here"; grid.dataSource.read();
Hi,
I have an upload control that the validation is not working on. I am setting it to restrict to .jpg only and 2mb but the save action is called no matter what I upload to it.
@(Html.Kendo().Upload() .Events(e => e.Success("onParent1UploadSuccess")) .Async(a => a .AutoUpload(true) .Save("SaveParent1", "HistoryForm", new { AdmissionPK = Model.AdmissionPK }) ) .ShowFileList(false) .Multiple(false) .Name("Parent1Upload") .Validation(v => v .AllowedExtensions(new string[] { ".jpg" }) .MaxFileSize(2097152) ) .Messages(m => m.Select("Select File...")))
How do I get the validation to actually work?
Thanks.