Hello,
I have followed this help article, how to bind CheckBoxGroup to model on razor page. This article does not show how to get selected values back on post.
https://docs.telerik.com/aspnet-core/html-helpers/editors/checkboxgroup/razor-page
OnPost CheckBoxGroupModel models that is bind property, it's CheckBoxGroupValue property stays null when posted back. Only way to get values back is to read them from Request.Forms["checkboxgroup"].
Hi,
I need to add a trash can against each option of the dynamic dropdown list.
example:
How can this be achieved?
What I have achieved so far:
Dynamically populating the list.
Thanks,
VM
The three dots buttons that open column menu settings work in the last three column but no in the others. On the other hand we use kendo windows, when we change the width of window; the column menu opener buttons work properly.
I am using the below line chart.
Is there a way to have the green series area filled in with green?
I would like the green series fully colored in as green. But leave the red series as a line.
</div>
Hello,
I have a Form with an Ajax POST method. One of the fields is a DateTime and when it is being posted, it uses some kind of long format with a mix of culture... It break the ASP Model and marks it as invalid as it's not recognised as a DateTime.
This is the payload from submiting the form, as you can see, the timezone is in french, while the date is in en-US. The client Kendo culture is also set as en-US.
DateRequete: Tue+Oct+11+2022+00:00:00+GMT-0400+(heure+d’été+de+l’Est)
This is the form submit function:
function onFormRequeteSubmit(ev) { //Fonction pour FormRequuete
ev.preventDefault();
var modelData = ev.model;
$.ajax({
type: 'POST',
url: "/FormHandler/Requete",
beforeSend: function (xhr) {
xhr.setRequestHeader('X-XSRF-TOKEN', getCookie('XSRF-TOKEN'));
},
data: modelData,
dataType: 'json',
success: function (data) {
//removed for clarity
},
error: function (data) {
//removed for clarity
}
})
};
I"ve tried the following before the $.ajax call, and it does post the date in a valid ISO format, but it breaks the post and somehow posts the actual page instead of the ajax url...
modelData.DateRequete.value = modelDate.DateRequete.toJSON();
How can I convert the date to a valid format before posting it and/or why is my client culture not set properly? This is the content of my <head>:
<script src="https://cdn.kendostatic.com/2022.2.510/js/cultures/kendo.culture.en-US.min.js"></script>
<script>
kendo.culture("en-US");
var culture = kendo.culture();
console.log(culture.name); // outputs "en-US"
</script>
When I click my (test) button to select a row (with Id = 2) in my grid, I get the error:
"Uncaught TypeError: Cannot read properties of undefined (reading 'get') at selectRowById".
Here is my function:
function selectRowById(id) {
var grid = $("#grid").data("kendoGrid")
var dataItem = grid.dataSource.get(id);
var dataItemUID = dataItem.get("uid");
var tableRow = $("[data-uid='" + dataItemUID + "']");
grid.select(tableRow);
}
Here is my grid:
@(Html.Kendo().Grid<Document>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.DocumentId).Title("Doc Id").Filterable(false).Width(90);
columns.Bound(p => p.StorageContainer).Title("Container").Width(100);
columns.Bound(p => p.FileName).Width(350);
columns.Bound(p => p.DocStatus).Width(125);
columns.Bound(p => p.FileSize).Width(125).HtmlAttributes(new { @style = "text-align: right" });
columns.Bound(p => p.ClientDocumentId).Title("Client Doc Id").Width(200);
columns.Bound(p => p.CreateDate).Format("{0:MM/dd/yyyy}").Width(130);
columns.Command(command => { command.Edit().Text(" "); command.Destroy().Text(" "); }).Width(150);
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Multiple)
.Type(GridSelectionType.Row))
.Pageable()
.Resizable(resize => resize.Columns(true))
.Pageable()
.Sortable()
.Scrollable()
.Reorderable(reorder => reorder.Columns(true))
.Filterable()
//.Groupable()
.HtmlAttributes(new { style = "height:650px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Model(model =>
{
model.Id(p => p.DocumentId);
model.Field(p => p.DocumentId).Editable(false);
model.Field(p => p.CreateDate).Editable(false);
})
.Read(read => read.Action("Read", "Document").Data("getApplicationId"))
.Create(update => update.Action("Create", "Document"))
.Update(update => update.Action("Update", "Document"))
.Destroy(update => update.Action("Delete", "Document"))
)
)
Any help would be greatly appreciated. Thanks.
Mark
I have grid below. I did not like the way buttons are displayed. so would like to do 1 of these:
1) move buttons to the bottom of the row to eliminate 2 column, mainly for mobile friendly
2) or at very least get rid of "Edit" & "Delete" label on these buttons to reduce space. When I removed button text, buttons no longer response to events. Why?
I have attached a screenshot. Could someone suggest a solution please!
@(Html.Kendo().Grid(Model)
.Name("grid")
.ToolBar(toolbar => {
toolbar.Search();
toolbar.Custom().Text("Add").IconClass("bi bi-plus-circle").HtmlAttributes(new { id = "AddButton", @class="floatRight" });
toolbar.Pdf().Text("PDF");
toolbar.Excel().Text("Excel");})
.Search(search=> search.Field(c=>c.Caption))
.Selectable(select => select.Mode(GridSelectionMode.Single))
.Events(ev => ev.Change("onChange"))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(false)
)
.Pageable()
.Sortable()
.Columns(columns =>
{
columns.Bound(f => f.Id).Visible(false);
columns.Bound(f => f.Odometer).Title("Equipment List").ClientTemplate("<p><strong>#=Caption#</strong></p> <ul><li>Odometer: #=Odometer #</li><li>Engine Hour: #=EngineHour #</li><li>Created date: #= CreateDateString #</li><li>Last maintenance: #= LastMaintenance?.Description # on #= LastMaintenance?.CreateDateString #</li></ul>");
columns.Command(command => {
command.Custom("Edit").IconClass("bi bi-pencil-square").Click("Update");
command.Custom("Del").IconClass("bi bi-trash").Click("Archive");
}).Title("Actions").Width(80);
})
)
I'm dealing with a situation specified here in the jQuery world: https://docs.telerik.com/kendo-ui/knowledge-base/combobox-invalid-form-control-is-not-focusable
I'm having a similar issue but am using a combination of tag-helpers and Html extension methods to render controls. Kendo Text boxes are getting client-validated properly, but DropDowns are not, and also some textboxes that are initially hidden are also facing the same issue.
I have a view setup the following way:
@for (var i = 0; i < Model.ApprovingRoles.Count; i++)
{
<div class="col-lg-6">
@(Html.Kendo().DropDownListFor(m => m.ApprovingRoles[i])
.Size(ComponentSize.Medium)
.Rounded(Rounded.Medium)
.FillMode(FillMode.Outline)
.OptionLabel("Select " + Model.ApprovingRoles[i].Name)
.HtmlAttributes(new { style = "width: 100%", required = "required", validationmessage = "Value required" })
.DataTextField(nameof(SystemUserModel.EmployeeName))
.DataValueField(nameof(SystemUserModel.Id))
.Filter(FilterType.Contains)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUsersByRoleId", "Api").Data(Model.ApprovingRoles[i].Id.ToString());
}).ServerFiltering(true);
})
.Height(500)
)
</div>
}
Currently:
Hello this is my Controller in my code I am trying to update or delete from the database.
I get a 200 status which says its succesful but it never gets updated or deleted.
I can read and create fine but updating is a little challenging.
this is the response i get from the debbuger when i edit a row:
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished HTTP/1.1 POST https://localhost:57770/Grid/ClientsEdit/14416 application/x-www-form-urlencoded;+charset=UTF-8 176 - 200 - application/json;+charset=utf-8 683.0242ms<div class="row"> <div class="col-12"> @(Html.Kendo().Grid <TelerikGangsApp.Models.ClientDatum>() .Name("grid") .Columns(columns => { //columns.Bound(p => p.Id); columns.Bound(p => p.FirstName); columns.Bound(p => p.MiddleName); columns.Command(command => command.Edit()).Width(150); columns.Command(command => command.Destroy()).Width(150); }) .ToolBar(toolbar => { toolbar.Create(); //toolbar.Save(); toolbar.Pdf(); toolbar.Search(); }) .Pdf(pdf => pdf //.AllPages() .AvoidLinks() .PaperSize("A1") .Margin("2cm", "1cm", "1cm", "1cm") .Landscape() .RepeatHeaders() .TemplateId("page-template") .FileName("Gangs.pdf") .ProxyURL(Url.Action("PdfExport", "Grid")) ) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Sortable() .Scrollable() .Filterable() .Groupable() .HtmlAttributes(new { style = "height:550px;" }) .DataSource(dataSource => dataSource .WebApi() .Batch(false) .PageSize(20) .ServerOperation(false) .Model(model => { model.Id(client => client.Id); model.Field(client => client.Id).Editable(false); }) .Read(read => read.Action("ClientRead", "Grid").Type(HttpVerbs.Get)) .Create(create => create.Action("ClientCreate", "Grid").Type(HttpVerbs.Post)) .Update(update => update.Action("ClientsEdit", "Grid", new {id = "{0}"}).Type(HttpVerbs.Post)) .Destroy(destroy => destroy.Action("ClientDelete", "Grid", new {id = "{0}"}).Type(HttpVerbs.Post)) ) ) </div> </div>