The model I have to work with has mixed Json property names. Can“t easiely unify them as that will break filtering on the db. While the grid has a seperate model from the db entity ToDataSourceResultAsync is called after mapping the IQueryable, so cosmosdb will use the json attributes on the grid model and not the db entity to generate the query. Prior to .net core there supposedly was a method to define the field name .From.
.Model(model =>
{
model.Field(p => p.Name).From("name");
})
The .From method no longer seems to exist. My workaround for now was to implement a custom extension method that uses reflection to set the name.
public static class KendoExtensions
{
public static DataSourceModelFieldDescriptorBuilderBase<T, TDataSourceModelFieldDescriptorBuilder> MapFrom<T, TDataSourceModelFieldDescriptorBuilder>(
this DataSourceModelFieldDescriptorBuilderBase<T, TDataSourceModelFieldDescriptorBuilder> builder, string name)
where TDataSourceModelFieldDescriptorBuilder : DataSourceModelFieldDescriptorBuilderBase<T, TDataSourceModelFieldDescriptorBuilder>
{
var fieldInfo = builder.GetType()
.GetField("descriptor", BindingFlags.Instance | BindingFlags.NonPublic);
var descriptor = (ModelFieldDescriptor)fieldInfo!.GetValue(builder);
descriptor!.From = name;
return builder;
}
}
Is there another way of doing this now? The above works just fine right now, but accessing protected members of 3rd party libraries is something I would very much like to avoid.
The following is the link where they said that there is supposed to be a .From method, but that does not seem to exist for me in 2023.1.117.
https://www.telerik.com/forums/json-serialization-breaks-grid
___
Only just now saw that the last reply said that this is only available when using a Custom Data Source. Guess I gotta do that instead then. Will try that tomorrow. Not sure why that would be required looks like a case of more boilerplate for no reason to me.
Hi,
I'm working on develop web application using MVC Core with Razor. I'm using kendo upload to upload excel file. After I got the uploaded excel file, I want to read the data to the temp table (or grid if possible). How do I get to the Posted File InputSteam to read or loop data to temp table? With asp.net web form, I used PostedFile.InputSteam to read data, how do I do that with kendo upload control?
Thank you for your help.
Hello,
I want the grid to be refreshed column wise as the DataTable datasource changes. Calling the client side read function refreshes the data source but does not refresh the columns based on the data source changing. We have filters that will remove/add columns since the DataTable is dynamic. I am populting the grid like below:
ASP.NET Core Dynamic Grid in ASP.NET Core - Telerik UI for ASP.NET Core
Thank you.
A new demo application called e-shop was released concomitant with the release of Telerik UI for ASP.NET Core 2023.1.117. Normally source code for demo programs can be installed as an option in the Control Panel. However, in this case, it appears, after some searching that the course code was not installed in the C:\Program Files (x86)\Progress\Telerik UI for ASP.NET Core R1 2023\wrappers\aspnetcore\Examples folder. Runnning the Demo Shortcut and clicking on the sample e-shop Applcation simply takes you to https://demos.telerik.com/aspnet-core/eshop/.
Can anyone point me to a download link for the source files for the e-shop sample application?
After converting my project from .NET 4.7.2 to .NET 6.0 I am facing below JS error for Kendo UI multiselect
readyException.js:9 Uncaught TypeError: Cannot read properties of undefined (reading 'off')
at init._editable (kendo.multiselect.js:537:40)
at init.readonly (kendo.list.js:201:18)
at new init (kendo.ts:796:30)
at HTMLSelectElement.eval (kendo.core.js:3469:32)
at Function.each (core.js:260:19)
at jQuery.fn.init.each (core.js:82:17)
at $.fn.<computed> [as kendoMultiSelect] (kendo.core.js:3468:26)
at HTMLDocument.<anonymous> (List:668:63)
at mightThrow (deferred.js:124:29)
at process (deferred.js:192:12)
Good morning,
Code:
<form-item field="TipologiaFormato" col-span="1">
<item-label text="Tipologia Formato:" optional="false" />
<dropdowntree-editor auto-close="false" dataspritecssclassfield="spriteCssClass" value-template-id="dropdowntree-value-template" template-id="dropdowntree-template" name="dropdowntree" style="width: 100%">
<hierarchical-datasource>
<schema>
<hierarchical-model id="id"></hierarchical-model>
</schema>
<transport>
<read url="@Url.Action("Items_GetAction", "Controller")" />
</transport>
</hierarchical-datasource>
<checkboxes check-children="true" enabled="true" />
</dropdowntree-editor>
</form-item>
I'm trying to use the pdf Viewer control to display pdfs which have fillable forms on them. When I open the pdf with viewer control the fillable pdfs just show up as a flat pdf (meaning the form fields are not fillable). Is there a way to get the PdfViewer control to display the pdf as a fillable pdf? I feel like with tools like RadPdf, this has got to be possible in the browser and would be surprised if there wasn't a way to do this with our Kendo controls.
Ultimately, I want to submit that filled in pdf back to the server to be saved back to the database.
Hi, I can't seen to find a fix for this:
I'm using .NET Core Telerik UI's Wizard feature along with its kendoValidator and the latter seems to be generating error messages, one example being the email address field - it'll generate an error message if the email doesn't follow the format allowed per the attributes in the view model. However, it's using the original field names despite my using the DISPLAY attribute in the VM. How can I go about changing the field name used in the client side when kendoValidator kicks in?
Example: ALT_EMAIL is not valid email. I'd like for it to say, This email address is not an valid email, instead.
FYI, I'm using .NET's tag helpers, not Telerik's, to generate the field names, inputs, etc.
<kendo-dropdownlist name="customer" style="width:100%"
datatextfield="Text"
datavaluefield="Value">
<datasource type="DataSourceTagHelperType.Custom">
<transport>
<read url="@Url.Action("GetCustomers", "Home")" />
</transport>
</datasource>
</kendo-dropdownlist>
public JsonResult GetCustomers(string text)
{
//var customers = _context.Customers.ToList();
var color_data = new List<SelectListItem>()
{
new SelectListItem() {
Text = "Black",
Value = "1"
},
new SelectListItem() {
Text = "Orange",
Value = "2"
},
new SelectListItem() {
Text = "Grey",
Value = "3"
}
};
return Json(color_data);
}
Hello!
I'm following these docs for inline gridview editing. My situation is a bit different than the doc samples. I've 3 grids on the page and working on adding an inline editing in one of them. Here's the code for that -
<form novalidate asp-controller="BusinessLines" asp-action="Update" method="post">
@(Html.Kendo().Grid<AJG.Cdi.Core.Models.BusinessLinesModel>()
.Name("grid2")
.Columns(columns =>
{
columns.Bound(b => b.CdPolicyLineTypeCode).Title("Line Type").Editable("false");
columns.Bound(b => b.EffectiveDate);
columns.Bound(b => b.ExpirationDate);
})
.ToolBar(toolBar =>
{
toolBar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:200px;" })
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Field(p => p.CdPolicyLineTypeCode).Editable(false);
})
.Update(update => update.Action("Update", "BusinessLines").Type(HttpVerbs.Post))
/*.PageSize(5)
.Read(read => read.Action("Get", "BusinessLines").Type(HttpVerbs.Get))*/
))
</form>
I want the above grid to hit BusinessLines\Update endpoint when pressed on "Save Changes", but it's going to the parent page's Action, which is Submissions\Edit. It's defeating the whole setup that I've put in-place.
If I do not refresh the page, it's throwing the errors listed in the 'error-1.png' attached file, while hitting 'Save Changes'
Also, please let me know - how can I get rid of time in the date field (ref: inline-editing-ui.png)?