After upgrading Kendo MVC from v2021.2.616 to v2024.2.514 (KendoUIProfessional), the dropdownlist "SeriesType" on the grid is not firing the onChange event anymore. I saw an error message in the browser console.
Can you guys suggest a migration solution for it? Thanks!
Browser console error:
cshtml
@(Html.Kendo().Grid<MySeriesModel>().Name("drpSeries")
.Columns(column =>
{
column.Bound(model => model.SeriesName).HtmlAttributes(new { style = "font-weight: bold" }).Title("No.").Width(40);
column.ForeignKey(c => c.SeriesType, (IEnumerable<SelectListItem>)ViewBag.LstSeriesType, "value", "text").HtmlAttributes(new { style = "text-align: left", onChange = "onChangeSeriesType('#=ID#'); setSerieXml();" }).Title("Series Type").MinScreenWidth(60);
column.Bound(model => model.SeriesTitle).Title("Series Title").HtmlAttributes(new { onChange = "setSerieXml();" }).MinScreenWidth(120).Encoded(false);
column.Bound(model => model.Axis).Title("Axis").ClientTemplate("#=getAxisActionLink(ID,Axis)#").MinScreenWidth(120);
column.ForeignKey(c => c.Y_Format, (IEnumerable<SelectListItem>)ViewBag.LstSeriesFormat, "value", "text").HtmlAttributes(new { style = "text-align: left", onChange = "onChangeFormat(this);" }).Title("Format").MinScreenWidth(150);
column.ForeignKey(c => c.Y_Axis, (IEnumerable<SelectListItem>)ViewBag.ListSerriesYAxis, "value", "text").HtmlAttributes(new { style = "text-align: left", onChange = "onChangeYAxis(this,'#=ID#');" }).Title("Y Axis Scale").Width(100);
column.Bound(x => x.ID).ClientTemplate("<button class= 'k-button' type='button' onclick=onRemoveSeries('#=ID#')>" + "Remove" + "</button>").HtmlAttributes(new { style = "text-align: center" }).Title("").Width(120);
})
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model =>
{
model.Id(item => item.ID);
model.Field(item => item.ID).Editable(false);
model.Field(item => item.SeriesName).Editable(false);
model.Field(item => item.Axis).Editable(false);
model.Field(item => item.SeriesTitle).Editable(false);
})
.Read(read => read.Action("SeriesList_DataSource", "Dashboard").Data("getDataForDgdSeries_Read"))
)
.Events(e =>
{
e.DataBound("onDataBoundDgdSeries");
})
.Resizable(x => x.Columns(true))
.AutoBind(true)
.Scrollable(x => x.Enabled(true))
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.HtmlAttributes(new { style = "overflow: auto; width:100%", @class = "form-group" })
)
JS
function onChangeSeriesType(id) {
drpSeries = $('#drpSeries').data('kendoGrid');
dataSource = drpSeries.dataSource;
var lstSerieRow = dataSource.data();
if (lstSerieRow[id - 1].Axis.length > 0) {
lstSerieRow[id - 1].SeriesTitle = "";
lstSerieRow[id - 1].Axis = "";
dataSource.fetch();
}
}
Model
public class MySeriesModel
{
public string ID { get; set; }
public string SeriesName { get; set; }
public string AxisName { get; set; }
public string Axis { get; set; }
[AllowHtml]
[UIHint("GridDropDownList")]
public string SeriesType { get; set; }
public string SeriesTitle { get; set; }
public string X_Ordinate { get; set; }
public string X_Format { get; set; }
[AllowHtml]
[UIHint("GridDropDownList")]
public string Y_Format { get; set; }
[AllowHtml]
[UIHint("GridDropDownList")]
public string Y_Ordinate { get; set; }
[AllowHtml]
[UIHint("GridDropDownList")]
public string Y_OrdinateTo { get; set; }
public string TOOLTIP_FORMAT { get; set; }
[AllowHtml]
[UIHint("GridDropDownList")]
public string Y_Axis { get; set; }
}
controller
public ActionResult RenderSeriesConfig(string viewName)
{
List<SelectListItem> seriesType = GetDashboadChartStyleTypeList();
string arrSeriesType = "";
for (int i = 0; i < seriesType.Count; i++)
{
arrSeriesType += seriesType[i].Text.ToString() + "," + seriesType[i].Value.ToString() + ";";
}
ViewBag.LstSeriesType = seriesType;
ViewBag.ArrSeriesType = arrSeriesType;
ViewBag.LstSeriesAxis_Ordinate = GetLstFieldNamesSelectListItem(viewName);
ViewBag.LstSeriesFormat = GetFormatShortList();
ViewBag.ListSerriesYAxis = GetYAxisSettingList();
return PartialView("_ChartDetail_Series");
}
A bug has been introduced recently where the calendar icon for DatePicker does not display
I can duplicate this bug using your REPL
https://demos.telerik.com/aspnet-core/datepicker
From here I add after line 9
.HtmlAttributes(new { @style = "width: 150px;"})
As you can see this results in no calendar to pick the date
If you make it even wider some of the icon becomes visible
.HtmlAttributes(new { @style = "width: 200px;"})
And at 250 it is fully visible
.HtmlAttributes(new { @style = "width: 250px;"})
We do this across our app using an extension method and it was previously working.
Hi,
I showing a grid where some columns has username information. when a user is inactive then the username has a strike trough styling by class
This column is a a ForeignKey with ClientTemplate for displaying and the EditorTemplateName to control the editing
what shows a dropdown with Template and ValueTemplate on the UIHint schtml.
And event databound to add a class for the strike trough styling.
So my grid column and dropdwon during edit are all having styling for inactive users
But when I click the filter icon the dropdown has to do the same
Where do I do that?
I cannot find any template or something else to control the ForeignKey bound dropdown.
Can someone help me with this styling problem?
Thanks
Summary
Struggling with this issue for weeks now. Please need help!
Goal - Stop the wizard from going to next step when there is a custom validation
Issue : The custom validation "Min age has to be 16 years " shows up on Validation blur , but does not stop the propagation to the next step.
validator.validate() comes up as true in both form and div approach
First approach
1. Addded a kendo wizard with a .Tag("div") tag so that 4 steps in there show up as individual forms
@(
Html.Kendo().Wizard()
.Name("LicenseWizard")
.Tag("form")
.Steps(s =>
{
s.Add<WizardViewModel>()
.Title("County")
.ClassName("CountyClass")
.Form(f => f
.Name("FormCounty")
.FormData(Model)
... There are 4 steps in total
2. Used this in the Onselect step method
function onSelect(e) {
// Get the current step's index
var stepIndex = e.step.options.index;
// Get the current step's container element
var container = e.sender.currentStep.element;
if (stepIndex < currentStep) {
e.preventDefault();
}
else {
// Validate Party One
if (stepIndex == 2) {
var form = $("#LicenseWizard-1").find('form');
var validator = form.data("kendoValidator");
alert('validator.validate()' + validator.validate());
// Validate given input elements
if (!validator.validate()) {
// Prevent the wizard's navigation
e.preventDefault();
}
Shows true and goes to next step
Second approach
1. Use the .Tag("form")
@(
Html.Kendo().Wizard()
.Name("LicenseWizard")
.Tag("div")
.Steps(s =>
{
s.Add<WizardViewModel>()
.Title("County")
.ClassName("CountyClass")
.Form(f => f
.Name("FormCounty")
.FormData(Model)
.Items(items =>
2. In the
// Validate
if (stepIndex == 2) {
var form = $("#LicenseWizard-1").find('form');
var validator = form.data("kendoValidator");
// Instantiate a validator for the container element
// Get the validator's reference
var validator = $(container).kendoValidator().data("kendoValidator");
alert('validator.validate()' + validator.validate());
// Validate given input elements
if (!validator.validate()) {
// Prevent the wizard's navigation
e.preventDefault();
Even this returns true
$(function () {
$("#LicenseWizard").kendoValidator({
rules: {
requiredIfValue: function (input) {
//debugger;
if (input.is("[data-val-requiredifvalue]") && !input.val()) {
....
}
minagedate: function (input) {
if (input.is("[id ='PartyOne.Pty1DateOfBirth']") || input.is("[id ='PartyTwo.Pty2DateOfBirth']")) {
var value = $(input).val();
...............//
//console.log('todayMinus16' + todayMinus16);
var result = (todayMinus16 >= birthdate);
return result;
}
Question : minagedate validate on blur works . When I click on next , on Step 2 , the container in the approach when i use a div tag on wizard is the form that I get manually and in the second approach it is container that I get using the step method.
I defined rules at the main wizard level ----
$(function () {
$("#LicenseWizard").kendoValidator({
how can make the validator.validate() false in my steps when there is something on the custom rules (that also show up on validate on blur) ?
I skipped 2024.1.319 so can't confirm if this behavior exists in that version.
Attached is screenshot of the first page (with blacked out redacted information). The 2024.1.130-exporttopdf-grid.png show expected/as is function of exporting a grid of data to pdf.
2024.2.514-exporttopdf-grid.png shows what the same data and grid. There is an "Exporting..." overlay message and the last row of data appears to be repeated and offset.
Is this a bug in 2024.2.514?
In a normal form which uses html validation adding required to a KendoDropDownList fails
Ive tried to research to find a solution, but its due to the field being hidden field behind the control
Thus you end up with an error similar to this
An invalid form control with name='CountryId' is not focusable.
I wish to know the proper way to show a validation message for a required dropdownlist in MVC