Hey guys,
currently I'm trying to get use of the tag helper in general. Now I'm stuck at the daterangepicker.
Can somebody describe how you can put an array to the definition? I'm talking about the "DisableDates".
Html.Kendo().DateRangePicker()
.DisableDates(new[] { "sa", "su" })
.Max(DateTime.Now.AddYears(1))
.Messages(m => m.StartLabel("Start").EndLabel("Ende"))
.Name("daterangepickerReservierungswunsch")
.Range(r => r.Start(Model.Startdatum).End(Model.Enddatum))
<kendo-daterangepicker name="daterangeReservation" disable-dates="???" max="DateTime.Now.AddYears(1)" >
<messages start-label="Start" end-label="Ende" />
<range start="Model.DateStart" end="Model.DateEnd" />
</kendo-daterangepicker>
I have a strange problem with one of my grids, everything works just fine in normal display, but when I switch to mobile display, the grid does not show up and I get this error in the console:
Uncaught TypeError: Ke.Pane is undefined
My other grids which almost have identical code structure to this one, works fine in both displays. Any idea what could be the reason for this error? Thank you in advance.
Good Afternoon,
ive been doing some work on upgrading to .net6 and have run into some telerik issues.
From my understanding Telerik.Windows.Controls.RichTextBox doesn't even exist anymore, nor is it installed anywhere in my solution. The closet thing to it is Telerik.Windows.Controls.RichTextBoxUI.
After i import telerik into my xaml file via
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
i receive errors stating
```
```
I'm not even sure were to look or what to try, as I've checked to make sure its not installed anywhere, triple checked, and also have deleted bin and obj folders tried to do a clean rebuild build. i don't even understand how it can think about wanting something from a package that isn't even installed
I am trying to use kendo grid in asp.net core (.net5) web application but data is not visible in grid I guess binding is not working.
Kendo grid is able make read data request to action method and also able to get result back but that result is not being bound to grid and I am not sure what is going wrong in here.
I have attached the sample project here.
Can someone help me find the issue?
For example:
The grid has 3 columns. Column 1 and column 2 should have a max-width while column 3 should have a min width.
What i aim for ist the following:
On resizing (to max) the Browser, Column 1 and 2 should expand to a set width, while Column 3 should have the remaining space.
This can be done by setting the width of column 1 and 2 without setting the width of column 3.
But on resizing from a large to small, the column 3 shrinks until its gone. A div width min-width, does not help. Some styles of
the grid prevents this default table behaviour, which i can't figure out.
Column 3 should shrink to a set width and column 1 and 2 should shrink further.
How can i accomplish this behaviour.
Hiding a column is not an option.
Thanks
Hi,
I have a requirement for a grid that allows a user to update a record but they cannot create new ones. If my grid defines only the read and update action, when I save a record I get a 400 error returned but the save does go through. The 400 error is returned before the save action has completed. I have narrowed the issue down to the fact that I did not have a create action defined.
Why does a create action need to be defined even when there is no toolbar that allows them to add new records?
Simplified version of my grid definition:
@(Html.Kendo().Grid<TimeStudy.NetCore.Web.Models.TSCodeAssociationModel>()
.Name("gridTSCodeAssociation")
.HtmlAttributes(new { sender = "gridTSCodeAssociation", title = "TS Code Associaton" })
.Columns(c =>
{
c.Command(commands =>
{
commands.Edit().Text(" ").CancelText("Close").UpdateText("Save").HtmlAttributes(new { title = "Edit Association" }).IconClass("fas fa-pencil-alt fa-xs iconColor k-sm").UpdateIconClass("rcit-k-remove-icon-span").CancelIconClass("rcit-k-remove-icon-span");
}).ClientHeaderTemplate(TimeStudy.NetCore.Web.Common.ViewConstants.KENDO_REMOVE_FILTER_BTN).Width(55).Visible(@isEditor);
c.Bound(f => f.TSCodeAssociationId).Hidden();
c.Bound(f => f.Code).Width(50);
})
.Pageable()
.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("EditTSCodeAssociation").Window(w => w.Title("Edit TS Code Association")))
.DataSource(dataSource =>
dataSource
.Ajax()
.Events(ex => ex.Error("function(e){gridWithSearchButton_onDataError(e, '#gridTSCodeAssociation')}"))
.Model(model =>
{
model.Id(f => f.TSCodeAssociationId);
})
.Read(read => read.Action("GridTSCodeAssociationAction", "TSCodeAssociation", new { method = "read" }).Data("kendoPageSearchParametersAntiForgery"))
.Update(read => read.Action("GridTSCodeAssociationAction", "TSCodeAssociation", new { method = "update" }).Data("kendoPageSearchParametersAntiForgery"))
//.Create(create => create.Action("GridTSCodeAssociationAction", "TSCodeAssociation", new { method = "create" }).Data("kendoSendAntiForgery"))
.PageSize(50)
)
.Events(e => e.DataBound("kendoGridLoadButtonReset_databound"))
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str.Clear()
.StartsWith("Starts with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to")
.Contains("Contains")
))
)
.Scrollable(s => s.Height(600))
.Sortable()
.AutoBind(true)
.Deferred()
)
If I leave the create action commented out I get the 400 error message and I can see the network call shown in the attached image right before the grid update call.
version 2022.1.119
Dear support teams.
I have a problem that I would like your help with.
using Telerik for AspNet.Core, with Grid control.
In the database, there is a list of goods, including goods code, name of goods, and unit price.
For example there are 3 goods
G01 - Goods 01 - 10$
G02 - Goods 02 - 20$
G03 - Goods 03 - 30$
On the grid I also created 3 corresponding fields,
When in add new row mode, enter the commodity code I want to display the name of the goods and the unit price as soon as I have entered "G01"
Do you have any solution to do it?
Thanks for your support.
Regards.
Hi,
I'm working with Kendo Grid with MVC Core. I try to do the total rows (picture below) for 2 columns
Total Tax Rate (line 8) = line 1 + 2 + 3 + 4 + 5 + 6 for column d and e
Net Tax Rate (line 10) = total of line 8 - line 9 for both column d and e
The users want to see new calculate total every time they make some changes. Any suggestion how to handle this requirement.
Thank you.
this is an Asp.net MVC Core 6.0 project referring latest Telerik Nuget dll - 2022.1.119
Builds fine locally. But fails in build server due to compatibility issue.
Below is the build log from server.
2022-03-01T03:27:30.5720121Z Checking compatibility for Microsoft.CodeAnalysis.CSharp.Workspaces 4.0.0 with .NETFramework,Version=v6.0. 2022-03-01T03:27:30.5721443Z Package Microsoft.CodeAnalysis.CSharp.Workspaces 4.0.0 is not compatible with net60 (.NETFramework,Version=v6.0). Package Microsoft.CodeAnalysis.CSharp.Workspaces 4.0.0 supports: 2022-03-01T03:27:30.5724004Z - netcoreapp3.1 (.NETCoreApp,Version=v3.1) 2022-03-01T03:27:30.5724701Z - netstandard2.0 (.NETStandard,Version=v2.0)
Compatibility Issue is because Telerik dll is referring to code analysis dll, which supports only .Net 3.0 core apps.
Please let me know how to resolve this. Why Telerik dll is pulling an lower framework (3.0 core) dependency for .net 6.0 project? Below is snapshot of dll reference in project. Let me know.
I have a grid which lets you create a new row and default values are set. When you create a new row, an API call is made to retrieve the default values which populates the columns. However I would like to set the default value of one of those columns but it is a dropdownlist column (separate API call that gets the values for that column).
To be more specific, I'm confused about is how to get the value "displayvalue" from the UVLJournalEntries model and set it as the default value for the dropdownlist. For example I have "default value" hardcoded here:
items.Add().Text("Journal Entries").Content(@<text>
@(Html.Kendo().Grid<ArusUI.Areas.UVL.Models.UVLJournalEntriesModel>()
.Name("JEGrid_#=PONum#_#=lineNum#") // template expression, to be evaluated in the master context
.Columns(columns =>
{
columns.Bound(p => p.distrPercent).Title("Distribution Percent").Width(16);
columns.Bound(p => p.amt).Title("Amount").Width(21); ;
columns.Bound(p => p.newCostCenter).Title("Cost Center")
.Width(18)
.ClientTemplate("\\#=newCostCenter.displayvalue\\#")
.Filterable(false);
columns.Bound(p => p.acctNum).Title("Account Nbr")
.Width(18);
columns.Bound(p => p.subAcctNum).Title("Sub Account Nbr")
.Width(17);
columns.Bound(p => p.refType).Title("Reference Type").Width(20);
columns.Bound(p => p.refNum).Title("Reference Nbr").Width(21);
columns.Bound(p => p.refSubNum).Title("Reference Sub Nbr").Width(25);
columns.Bound(p => p.project).Title("Project Nbr").Width(20);
columns.Bound(p => p.activityID).Title("Activity ID").Width(20);
columns.Bound(p => p.userDef).Title("User Defined").Width(25);
})
.ToolBar(toolbar =>
{
toolbar.Create().HtmlAttributes(new { Id = "AddId_#=PONum#_#=lineNum#" });
toolbar.Custom().Text("Undo").Name("Cancel").HtmlAttributes(new { Id = "UndoId_#=PONum#_#=lineNum#" });
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Selectable(selectable => selectable
.Mode(GridSelectionMode.Single))
.Events(ev => ev.Edit("onJEEdit"))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Model(model =>
{
model.Id(field => field.id);
//model.Field(field => field.newCostCenter.displayvalue).Editable(true);
model.Field(field => field.newCostCenter).DefaultValue(new ArusUI.Areas.UVL.Models.CostCenterModel() { displayvalue = "default value" });
})
)
.Sortable()
.Pageable()
.Resizable(resize => resize.Columns(true))
.Width(2050)
.ToClientTemplate())
</text>
That part that I highlighted in orange kind of explains what I tried to do but I get the error "newCostCenter" is not defined.
This is the Edit event which populates the default values:
function onJEEdit(e) {
var URL = '/UVL/GetJournalEntries/'
var arrValues = e.sender._cellId.split('_');
var lineNbr = arrValues[2].substring(0, 4);
var PONbr = arrValues[1];
var POReleaseNbr;
if (PONbr.length <= 8) {
POReleaseNbr = "";
} else {
POReleaseNbr = PONbr.substring(0, 8);
};
var jeGrid = $(`#JEGrid_${PONbr}_${arrValues[2]}`).data("kendoGrid");
var detailGridWrapper = jeGrid.wrapper;
var parentRow = detailGridWrapper.closest("tr.k-detail-row").prev("tr");
var parentGrid = parentRow.closest("[data-role=grid]").data("kendoGrid");
var parentModel = parentGrid.dataItem(parentRow);
var JEGridData = jeGrid.dataSource.data();
var oldData = jeGrid.dataSource._pristineData;
var newData = jeGrid.dataSource._data;
var dataText = $("#Facility").data("kendoDropDownList").text();
var facility = dataText.split('-');
var _facilityCode = $.trim(facility[0]);
var _facilityDesc = $.trim(facility[1]);
$.ajax({
type: 'GET',
url: URL,
data: { facility: _facilityCode, description: _facilityDesc, purchaseOrderNbr: PONbr, poReleaseNbr: POReleaseNbr, lineNbr: lineNbr },
dataType: 'json',
success: function (data) {
test = data;
if (data != "error" && data != undefined) {
var distrPercent = data.journalEntries[0].distrPercent;
costCenter = data.journalEntries[0].costCenter;
account = data.journalEntries[0].acctNum;
amt = data.journalEntries[0].amt;
referenceType = data.journalEntries[0].refType;
referenceNbr = data.journalEntries[0].refNum.toString();
referenceSubNbr = data.journalEntries[0].refSubNum;
if (data.journalEntries[0].projectNbr != null) { projectNbr = data.journalEntries[0].projectNbr; };
if (data.journalEntries[0].activityId != null) { activityId = data.journalEntries[0].activityId; };
userDef = data.journalEntries[0].userDef;
if (e.model.isNew() && !e.model.dirty) {
newData[0].set("distrPercent", distrPercent);
newData[0].set("amt", amt);
newData[0].set("refType", referenceType);
newData[0].set("refNum", referenceNbr);
newData[0].set("refSubNum", referenceSubNbr);
newData[0].set("project", projectNbr);
newData[0].set("activityID", activityId);
newData[0].set("userDef", userDef);
} else {
//not complete
}
}
else {
Swal.fire(
'Something went wrong!',
'Please Try again',
'error'
);
}
}
});
}
Here are the controller methods for getting default values (GetJournalEntries) and getting the values for the dropdownlist column (GetCostCenter):
public async Task<JsonResult> GetJournalEntries(string facility, string description, string purchaseOrderNbr, string poReleaseNbr, int lineNbr)
{
string baseUrl = string.Empty;
HttpClientHandler clientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; }
};
using var client = new HttpClient(clientHandler, true);
int line = lineNbr;
string lineNbrStr = UVLFunctions.FmtLineNbr(line);
try
{
if (!String.IsNullOrEmpty(facility) && purchaseOrderNbr != null)
{
baseUrl = _iconfiguration.GetValue<string>("API:UVL") + "/Jes/?facility="
+ facility + "&description=" + description + "&purchaseOrderNbr=" + purchaseOrderNbr + "&poReleaseNbr=" + poReleaseNbr + "&lineNbr=" + lineNbrStr;
var response = await client.GetStringAsync(baseUrl);
JEGridModel allJEs = JsonConvert.DeserializeObject<JEGridModel>(response);
var id = 0;
foreach (var item in allJEs.journalEntries)
{
item.id = id;
id++;
};
allJEs.journalEntries.ForEach(c => c.newCostCenter = new CostCenterModel() { displayvalue = c.costCenter });
return Json(allJEs);
}
else
{
return Json("");
}
}
catch (System.Exception e)
{
throw e;
}
}
public async Task<JsonResult> GetCostCenter(string facilityCode, string facilityDesc)
{
try
{
string baseUrl = _iconfiguration.GetValue<string>("API:UVL") + "/CostCenters/?facility=" + facilityCode + "&description=" + facilityDesc;
HttpClientHandler clientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; }
};
var json = await new HttpClient(clientHandler).GetStringAsync(baseUrl);
CostCenterListModel costCenter = JsonConvert.DeserializeObject<CostCenterListModel>(json);
//costCenter.uvlCostCenter.Sort((v1, v2) => v1.displayvalue.CompareTo(v2.displayvalue));
return Json(costCenter.uvlDatalist);
}
catch (System.Exception e)
{
throw e;
}
}
EditorTemplate for dropdownlist column:
@model ArusUI.Areas.UVL.Models.CostCenterModel
@using Kendo.Mvc.UI
@(Html.Kendo().DropDownListFor(model=>model)
.DataValueField("displayvalue")
.DataTextField("displayvalue")
.OptionLabel("--Select--")
.HtmlAttributes(new { style = "font-size:inherit;width:100%;height:1.3rem;align-items: center" })
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCostCenter", "UVL").Data("GetFacilityCode");
}).ServerFiltering(false);
})
)
Model for journal entry grid and model for dropdownlist:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace ArusUI.Areas.UVL.Models
{
public class JEGridModel
{
public List<UVLJournalEntriesModel> journalEntries { get; set; }
}
public class UVLJournalEntriesModel
{
public int id { get; set; }
[Range(0, 100)]
public string distrPercent { get; set; }
public int amt { get; set; }
[UIHint("UVL/CostCenter")]
public CostCenterModel newCostCenter { get; set; }
public string costCenter { get; set; }
[UIHint("UVL/AccountNumber")]
public AccountNumberModel newAccountNumber { get; set; }
public string acctNum { get; set; }
public string subAcctNum { get; set; }
public string refType { get; set; }
public string refNum { get; set; }
public string refSubNum { get; set; }
public string project { get; set; }
public string activityID { get; set; }
public string userDef { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ArusUI.Areas.UVL.Models
{
public class CostCenterListModel
{
public List<CostCenterModel> uvlDatalist { get; set; }
}
public class CostCenterModel
{
public string displayvalue { get; set; }
}
}