Dear Admin,
I would like to ask about can FileManager upload with extra parameter?
Regards,
EL

I put a button, call the post method to change data. I want to refresh the grid to show the data. Please help.


Hi to all,
I have this collection routine
contacts = from rec in _context.Contacts.Include("SellToContacts") where rec.ParentContactFK.HasValue == false select rec;DataSourceResult result = contacts.ToDataSourceResult(request);return Json(result);Contact model is configured in this mode
[...]public Contact ContactParent { get; set; } [Column("Parent Contact Id", TypeName = "int")][Display(Name = "Società Principale")]public int? ParentContactFK { get; set; }[ForeignKey("ParentContactFK")]public ICollection<Contact> SellToContacts{ get; set; }[...]with this collection I would show a column that shows a Count of SellToContacts, that there are children of primary contact.
If a try to debug a collection, I found , correctly, some SellToContacts loaded of several children.
[...]@(Html.Kendo().Grid<Portale.Web2.Data.Entities.Contact> () .Name("contactGrid") .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("GetContacts", "Contacts").Data("addInfo")) ) .Columns(columns => { columns.Bound(c => c.Date).Format("{0:dd/MM/yyyy}"); columns.Bound(c => c.Name); columns.Bound(c => c.SellToContacts.Count);[...]Why not appears into a grid?
Where I wrong?
Hello,
I am using an aspnetcore Grid and I noticed that the style of the edit form is different from the rest of the site.
For information, my site is setup to use the telerik bootstrap 4 style with custom colors (used the Telerik Theme Builder)
The problem I experience seems related to the classes used in my site versus the demo. In the demo (https://demos.telerik.com/aspnet-core/grid/editing-popup), the control classes all use a k- prefix. "k-textbox" "k-input" "k-numerictextbox". On my site, the classes are text-box single-line only. When I manually change them to k-textbox for example, the css applies and is displayed properly.
Did I configure something improperly for the classes used to be different from the demo?
Any help would be appreciated!
Hi Everyone,
I am trying to set the Kendo Grid with Group by specific column by default, so I have used the code snippet as shown below:
@(Html.Kendo().Grid<StudentRecord>().Name("Grid")
.Groupable()
.Sortable()
.GroupPaging(true)
.Group(x => x.Add(y => y.StartYear))
And I realised it always displays the StartYear groups in ascending order by default.
Please advise how I could set the StartYear groups to sort in descending order by default.
Thank you.
I am using the new System.Text.Json in asp.net core and I noticed that the grid does not bind to the model when using the new .net Core Json library. If I use Newtonsoft.Json the bind binding works fine.
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(IISDefaults.AuthenticationScheme);
services.AddKendo();
services.AddControllersWithViews();
//.AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
}
@(Html.Kendo().Grid<TestModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(e => e.email);
columns.Bound(e => e.username);
})
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(100)
.Read(read => read.Action("Read", "home"))
)
)
Model
public class TestModel
{
public string archiveGuid { get; set; }
public string orgUid { get; set; }
public string orgName { get; set; }
public string orgExtRef { get; set; }
public string userUid { get; set; }
public string username { get; set; }
public string email { get; set; }
}
Here is what is returned with NewtonSoft JSON. I also noticed that D in the data response sent is capitalized when using Newtonsoft.json. Any ideas? It could be due to the contract resolver not being set when we are using the System.Text.Json as posted here https://www.telerik.com/forums/grid---binding-doesn't-work but I don't think there is a contract resolver option for the System.Text.Json.
So I have a grid, with a template for the command buttons. The reason I have the template, is I'm not allowing in-line editing, and the "edit" button will take the user to a detail page where they get access to the full model record.
I also have a "delete" button, but I can't figure out how to perform the delete from the template. I tried what I've seen in others and attempt to get the closest "tr" and then call "removerRow", but that did not work.
<script type="text/x-kendo-template" id="Commands"> <form method="post" action="@Url.Page("/clients/client", new { area = "" })" style="float: left; margin-right: .55rem"> <button type="submit" class="btn btn-info waves-effect waves-light">Edit</button> <input name="companyId" type="number" value="#= CompanyId #" hidden="hidden" /> @Html.AntiForgeryToken() </form> <button name="btnDelete" class="btn btn-danger waves-effect waves-light" onclick="deleteObject()">Delete</button> </script> <script> var commandTemplate = kendo.template($('#Commands').html()); </script> <script type="text/javascript"> function deleteObject() { var row = $(this).closest("tr"); $("#clientGrid").data("kendoGrid").removeRow(row); } </script>@(Html.Kendo().Grid<CaterX2.Models.Client.Client>() .Name("clientGrid") .Columns(columns => { columns.Bound(p => p.CompanyName).Title("Client"); columns.Bound(p => p.Address1); columns.Bound(p => p.Address2); columns.Bound(p => p.City); columns.Bound(p => p.State.StateCode).Title("State").Width(100); columns.Bound(p => p.ZipCode).Title("Zip Code").Width(150); columns.Bound(p => p.PhoneNumber).Title("Phone").Width(150); columns.Bound(p => p.CompanyId).ClientTemplate("#=commandTemplate(data)#").Width(200); }) .Pageable() .Sortable() .Scrollable() .Selectable(s => s.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row)) .HtmlAttributes(new { style = "height:430px;"}) .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Events(events => events.Error("error_handler")) .Model(model => model.Id(p => p.CompanyId)) .Read(r => r.Url("/index?handler=Read").Data("forgeryToken")) .Update(e => e.Url("index?handler=Edit")) .Destroy(d => d.Url("index?handler=Delete").Data("forgeryToken")) ) )
I'm trying to define a grid where the first column is a checkbox and the 2nd has a large font bound to "name" with a small font below it showing the "description". I'd appreciate a working example.
This is NOT working:
<script id="rowTemplate" type="text/x-kendo-tmpl"> <tr data-uid="#: uid #"> <td class="checkbox"> <input type="checkbox" name="optCheck" /> </td> <td class="details"> <span class="name">#: Name #</span> <span class="desc">#: Description #</span> </td> </tr> </script> @(Html.Kendo().Grid<SessionOptionTemplate>() .Name("template-grid") .ClientRowTemplate("rowTemplate") .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Read(read => read.Action("IndexJson", "SessionOptionTemplates") .Data("getData")) ))
Style
<style> .checkbox { width: 75px; } .details { width: 400px; } .name { display: block; font-size: 1.6em; } .desc { display: block; padding-top: 1.6em; font-size: small }</style>
I'm failing somewhere in my load of a TreeList. I added a simple error handler like this:
<script id="icon-template" type="text/x-kendo-template"> <div class='group-photo' style='background-image: url(@Url.Content("~/images/32/neighbourhood.png"));'></div> <div class='group-name'>#: Name #</div></script><div class="demo-section k-content"> <h4>Customer Groups</h4> @(Html.Kendo().TreeList<GsiPortal.Models.Group>() .Name("treelist") .Columns(columns => { columns.Add().Field(e => e.Name).Width(220).TemplateId("icon-template"); columns.Add().Field(e => e.Description); columns.Add().Field(e => e.AddTimestamp).Width(220).Title("Timestamp").Format("{0:MMMM d, yyyy}"); columns.Add().Command(c => { c.CreateChild().Text("Add"); }).HtmlAttributes(new {style = "text-align: center;"}); columns.Add().Command(c => { c.Edit(); }).HtmlAttributes(new { style = "text-align: center;" }); columns.Add().Command(c => { c.Destroy(); }).HtmlAttributes(new { style = "text-align: center;" }); }) .Editable(e => e.Mode(TreeListEditMode.PopUp).TemplateName("GroupEdit")) .Selectable(selectable => selectable.Mode(TreeListSelectionMode.Single)) .DataSource(dataSource => dataSource .ServerOperation(false) .Create(create => create.Action("CreateJson", "Groups")) .Read(read => read.Action("AllJson", "Groups") .Data("groupsRead")) .Update(update => update.Action("UpdateJson", "Groups")) .Destroy(delete => delete.Action("DestroyJson", "Groups")) .Model(m => { m.Id(f => f.Id); m.ParentId(f => f.ParentId); m.Expanded(true); m.Field(f => f.Name); m.Field(f => f.Description); m.Field(f => f.AddTimestamp).Editable(false); }) .Events(x => x.Error("onError")) )) <script> var groupId = Number(@(ViewBag.GroupId)); function groupsRead() { return { id: groupId }; } function onError(e) { alert(e.toString()); } </script>
However, this doesn't give me any clue as to what object type is there to pull the message from. What is the recommended way of doing Error Handling with this control that will give me some actionable information?
Thanks, Joel
