Hello,
I have a Razor build-ed grid which the datasource is WebAPI. The model contains a decimal field.
In Dutch (nl-NL) the separated character for decimal is comma instead of dot.
When setting in JS the Kendo.culture to "nl-NL", and the input contains a comma as ​decimal separated character, the ​created JSON model from Kendo Grid to the WebAPI contains also the comma instead of dot. At server-side the input will bbe set without decimal.
Example: 34,45 is in the JSON and gives 3445.
If the culture is removed, the JSON contains the dot and all works fine.
Question is, can I force the generated JSON model to handle input always as default culture (dot as decimal separated)?
This is part of my custom editor:
<div data-container-for="studentID" class="k-edit-field">
@(Html.Kendo().ComboBoxFor(model => model.StudentID)
.HtmlAttributes(new { data_bind = "value:StudentID" })
.DataTextField("FullName")
.DataValueField("StudentId")
.Filter(FilterType.Contains)
.AutoBind(false)
.Placeholder("Start typing student's name...")
.Text(Model.StudentID != null ? Model.Title : "")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetStudents", "Student").Data("filterStudents");
})
.ServerFiltering(true);
})
.Events(e =>
{
e.Select("onStudentSelected");
})
)
</div>
<div data-container-for="title" class="k-edit-field">
@(Html.HiddenFor(model => model.Title, new { id = "TitleId", data_bind = "value:title" }))
</div>
I am trying to set the title with the text from the combobox:
function onStudentSelected(e) {
var dataItem = this.dataItem(e.item.index());
$("#TitleId").val(dataItem.FullName);
};
Alert on $("#TitleId").val() shows that it is set. But when I save the template the value is not passed to the server.
I have also made Title just a standard textboxfor so that I can see that the value is set.
Why is this not persisting to the model?
Also, this is my schduler:
@(Html.Kendo().Scheduler<Excent.Apps.Web.Solo.Models.MeetingViewModel>()
.Name("scheduler")
.Date(DateTime.Today)
.StartTime(DateTime.Today.AddHours(8))
.EndTime(DateTime.Today.AddHours(23).AddMinutes(59))
.Height(600)
.Views(views =>
{
views.DayView(dw => dw.DateHeaderTemplate("#=kendo.toString(date, 'd')#")).ShowWorkHours(true);
views.WeekView(weekView => weekView.DateHeaderTemplate("#=kendo.toString(date, 'MM/dd')#").SelectedDateFormat("{0:MM/dd/yyyy} to {1:MM/dd/yyyy}")).ShowWorkHours(true).Selected(true);
views.MonthView();
views.AgendaView(aw => aw.Title("Session").SelectedDateFormat("{0:MM/dd/yyyy} to {1:MM/dd/yyyy}"));
})
.Editable(editable =>
{
editable.TemplateName("CustomEditorTemplate");
})
.Timezone("Etc/UTC")
.EventTemplateId("event-template")
.DataSource(d => d
.Model(m =>
{
m.Id(f => f.MeetingID);
m.Field(f => f.Start);
m.Field(f => f.End);
m.Field(f => f.IsAllDay);
m.Field(f => f.Title);
m.Field(f => f.RecurrenceRule);
m.Field(f => f.Description);
m.Field(f => f.StudentID);
m.Field(f => f.ProcedureCode);
m.Field(f => f.Color);
m.RecurrenceId(f => f.RecurrenceID);
})
.Events(e => e.Error("error_handler"))
.Read("Meetings_Read", "ProviderHome")
.Create("Meetings_Create", "ProviderHome")
.Destroy("Meetings_Destroy", "ProviderHome")
.Update("Meetings_Update", "ProviderHome")
)
)
Is there a way to disable drag and drop for tasks in the scheduler?
I want my users only to be able to edit tasks through the edit form.
/Jonas
I have a very simple listview that I cannot get to show any data.
View:
@(Html.Kendo().ListView<PortalContext.Root>()
.Name("leafView")
.TagName("div")
.ClientTemplateId("leafTemplate")
.DataSource(dataSource => {
dataSource.Model(model => { model.Id(p => p.RootId);
model.Field<string>(f => f.ShortName);
});
dataSource.Read(read => read.Action("Leafs", "Home").Data("branchLevel"));
})
)
<script type="text/x-kendo-tmpl" id="leafTemplate">
<div style="height:100px">
#: ShortName #
</div>
</script>
I have a treeview that refreshes the data onSelect
function onSelect(e) {
if (treeview.dataItem(e.node).IsBranch) {
branchId = treeview.dataItem(e.node).id;
$("#leafView").data("kendoListView").dataSource.read();
}
}
function branchLevel() {
return {
branchId: branchId
};
}
I have simplified a few things but my controller looks like this and is basically returning a list of objects.
public ActionResult Leafs([DataSourceRequest]DataSourceRequest request, int? branchId) {
return Json(ViewModel.Roots.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
Any ideas why this may not be working?
Bill
I use the Ajax Editing to manage the record in my grid .
I would like call the controller before edit the selected record to check if the record is not lock.
I would like have this process :
- Click on "Edit" buttom on grid,
- Call the action controller to check the lock,
-> If record lock, Abort Edit record,
-> If record is not lock, Edit record.
Do you know of a great way to make this process ?
Thanks
I set up a simple grid like this using the Razor syntax:
@(Html.Kendo().Grid<GridCustomPopupTemplate.Models.Person>().Name("persons") .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(m => m.PersonID)) .Read(read => read.Action("GetPersons", "Home")) .Update(up => up.Action("UpdatePerson", "Home")) ) .Columns(columns => { columns.Bound(c => c.PersonID).Width(200); columns.Bound(c => c.Name); columns.Command(cmd => { cmd.Edit(); }); }) .Pageable() .Sortable() .Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("Person")))Hello, is it possible to have a "Preview Row" (see attached picture) with MVC Grid?
robert
I need to stop collapsing a detail row in kendo grid in some cases, but my code is not working:
var detailGrid = $("#grid-details").kendoGrid({
< ....>
detailCollapse: function (e) {
//operator.views.common.CheckDetailsRow(e.detailRow);
e.preventDefault();
return false;
},
<......>
}).data("kendoGrid");
Hi,
I have a Kendo Grid in which I use Data method in Read.Action to pass parameters to a controller action. The code is:
<% Html.Kendo().Grid<EvaluationsQuestionsEvaluationPillarsGridViewModel>()
.Name("Pillars")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(a => a.EvaluationMasterPillarId))
.ServerOperation(true)
.Read(read => read.Action("LoadEvaluationsQuestionsEvaluationPillarsGridAjax", "Evaluations")
.Data("onLoadEvaluationsQuestionsEvaluationPillarsGridData"))
)​
......
function onLoadEvaluationsQuestionsEvaluationPillarsGridData(e) {
var evaluationVersionId = $('#evaluationVersionId').val(); // "evaluationVersionId" is set beforehand
var showDeletedCheckbox = $('#Checkbox1').val();
return { evaluationVersionId: evaluationVersionId, showDeleted: showDeletedCheckbox }
}
public ActionResult LoadEvaluationsQuestionsEvaluationPillarsGridAjax(DataSourceRequest request, string evaluationVersionId, bool showDeleted)
{
......
But the controller action "LoadEvaluationsQuestionsEvaluationPillarsGridAjax" is not even invoked. I need help on this. Thanks.
​Hi there, I was wondering if someone could help me. How can I bind my dropdown list to a viewbag to ensure it's getting it's data from the right place? I found a couple of guides but they didn't work for my scenario. Here is my code.
// #DDL - Broker Companies IEnumerable<SelectListItem> thestats = seabrokersData.tbl_requirement_status .Select(c => new SelectListItem { Value = c.id.ToString(), Text = c.thet_status }); ViewBag.theStatus = theStatus;
I would like my Kendo Dropdown to use the above viewbag to populate itself. How can I do this?
Many thanks