I am using asp.net mvc kendo tools. I have a int property from my c# model side, see below:
public class MyModel
{
[Required]
public int MyIntField {get;set;
}
in the view side I am adding the column using Kendo Grid selector
...
.Columns(c => c.Bound(my=>my.MyIntField))
...
That field always shows with zero when an edit popup screen is called. How can I avoid that still keeping the automatic required UI validations and without messy changing the DOM directly using javascript?
I'm looking for a kendo selector solution or a c# attribute side solution. But maybe I am asking for too much.
thanks
Ho Do I tranform this code in the @(Html.Kendo()) razor mvc style?
$("#grid").data("kendoGrid").dataSource.filter({
field: "date",
//create custom filter operator
operator: function(fieldDate) {
var parsedSelectedDate = kendo.parseDate(selectedDate);
//parse the field date in order to ignore the time
var parsedFieldDate = new Date(fieldDate.getFullYear(), fieldDate.getMonth(), fieldDate.getDate());
var result = (parsedFieldDate.getTime() == parsedSelectedDate.getTime());
return result;
},
value: selectedDate
});
I came accross this code that I need to implemente on my numeric column in a grid that uses popup editor:
...
columns: ["ProductName",{ field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: 120,editor: editNumber },{ field: "Discontinued", width: 120, editor: customBoolEditor },{ command: "destroy", title: " ", width: 150 }], editable: true});});
...
How can I do the same in the razor selector, ex:
columns.Bound(c=>c.UnitPrice).Title("Unit Price").???
thanks
Hi,
I have created a Telerik MVC Grid as follows. I have binded Datatable to the grid as the number of columns vary time to time. So, I cannot use the in-build CRUD methods.
1. Can you please help me how to proceed?
2. Also I have tried using Client Template and it throws exception "System.InvalidOperationException: Child actions are not allowed to perform redirect actions."
I have gone through the
@(Html.Kendo().Grid(Model.Department).Name("Model.Department")
.Columns(col =>
{
foreach (System.Data.DataColumn column in Model.Department.Columns)
{
if (column.ColumnName != "DEPTID")
col.Bound(column.ColumnName).EditorTemplateName("string");
}
col.Template(@<text></text>).ClientTemplate(Html.ActionLink("Delete","DeleteDepartment",new {id = "#=DEPTID#"}).ToHtmlString());
})
.ToolBar(toolbar =>
{
toolbar.Save();
})
.Pageable()
.Sortable()
.Editable(ed => ed.Mode(GridEditMode.InCell))
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(true)
.Model(model =>
{
var id = Model.Department.PrimaryKey[0].ColumnName;
model.Id(id);
foreach (System.Data.DataColumn column in Model.Department.Columns)
{
var field = model.Field(column.ColumnName, column.DataType);
if (column.ColumnName == id)
{
field.Editable(false);
}
}
})
.Create("CreateDepartment", "Administration")
.Read("GetDepartments", "Administration")
.Update("UpdateDepartment", "Administration")
))
I
Hello there,
I made a button for the Scheduler grouping,
So if I group the scheduler, the left border line will disappear (Screenshot 2020-09-16 142154_LI.jpg)
Then i looked if this disappearing has something to do with the CSS classes ! and i found this (Class_agenda.png)
is there any purpose behind this ? or is it just the wrong class in the wrong View and i should remove it ? :-)
Thanks in advance
Blackout
Hi, i have this code, everything work good except the search panel. I miss something?
@(Html.Kendo().Grid<
GestionLaboratorio.Models.BD_HCE.LAB_GetContenedorOpenLab_Result
>()
.Name("gridOpenLab")
.Columns(columns =>
{
columns.Bound(p => p.id).Title("ID").Width(100);
columns.Bound(p => p.nombre).Title("Descripcion");
columns.Bound(p => p.abreviatura).Title("Abreviatura").HtmlAttributes(new { style = "text-align: center;" }).HeaderHtmlAttributes(new { style = "text-align: center;" });
columns.Bound(p => p.tipoImpresion).Title("Tipo de impresion").EditorTemplateName("TipoImpresionOpenLab").ClientTemplate("#:DescTipoImpr#").HeaderHtmlAttributes(new { style = "text-align: center;" });
columns.Command(command => { command.Edit().Text(" ").CancelText(" ").UpdateText(" "); command.Destroy().Text(" "); }).Width(150).HtmlAttributes(new { style = "text-align: center;" });
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.ToolBar(t => t.Search())
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height: 500px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(8)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(f => f.id);
})
.Read(read => read.Action("Get_Contenedor_OpenLab", "OpenLab"))
.Update(update => update.Action("Update_Contenedor_OpenLab", "OpenLab"))
.Destroy(destroy => destroy.Action("Delete_Contenedor_OpenLab", "OpenLab"))
)
.Events(events => events.Save("contenedorGuardado_Save"))
.Resizable(resize => resize.Columns(true))
public
ActionResult Get_Contenedor_OpenLab([DataSourceRequest]DataSourceRequest request)
{
try
{
return
Json(bd_hce_lab.LAB_GetContenedorOpenLab().ToList().ToDataSourceResult(request));
}
catch
(Exception e)
{
return
Json(
null
);
}
}
@(Html.Kendo().Upload()
.Name(
"CreateMediaSelect"
)
.Async(a => a
.Save(
"MyActionName"
,
"ControllerName"
)
.AutoUpload(
true
)
)
.Events(events => events
.Success(
"OnSuccess"
)
.Upload(
"OnUpload"
)
)
)
public ActionResult MyActionName(IEnumerable<
HttpPostedFileBase
> CreateMediaSelect)
Using some examples I see in this forum, I am just trying to create a simple modal window on the fly via javascript. This is called from a JS function to create and open a new window that I can then refresh the content via an ajax post call. The line var win=... I get win = undefined. Clearly I'm missing something basic?
$('#windowX').kendoWindow({
width: "900px",
height: "500px",
title: "Add Temp Node",
visible: true,
modal: true,
resizable: true,
actions: ["Close"],
}).data('kendoWindow');
var win = $('#windowX').data('kendoWindow');
win.center().open();