Telerik Forums
UI for ASP.NET MVC Forum
0 answers
97 views

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");
}

 

Ronan
Top achievements
Rank 1
 asked on 07 Aug 2024
1 answer
99 views

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.

        public static DatePickerBuilder Width(this DatePickerBuilder builder, int width)
        {
            builder.ToComponent().HtmlAttributes.Merge("style", "width:" + width.ToString() + "px");
            return builder;
        }
Ivan Danchev
Telerik team
 answered on 02 Aug 2024
1 answer
100 views

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

Alexander
Telerik team
 answered on 30 Jul 2024
1 answer
182 views

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

  • Custom rules at the begining , which work on validate blur

 $(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) ? 

 

 

 

Mihaela
Telerik team
 answered on 26 Jul 2024
1 answer
133 views

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?

Eyup
Telerik team
 answered on 23 Jul 2024
1 answer
107 views
when i click my dropdown list(Multiselect)it is not opening in my application. Please note the same is working fine in trial version(2022.1.119.545) but stop working when i moved to licensed version(2022.2.510.545)
Anton Mironov
Telerik team
 answered on 11 Jul 2024
1 answer
333 views

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

Ivaylo
Telerik team
 answered on 11 Jul 2024
1 answer
82 views
In my ASP.NET  MVC existing project we have used trail Telerik UI for ASP.NET  MVC version 2022.1.119.545 and after that we have upgraded to developer version 2022.2.510.545 we have facing issue with dropdown with multi select checkbox not working in developer version
Eyup
Telerik team
 answered on 11 Jul 2024
1 answer
116 views
Hello,
I am currently converting kendo external template to CSP template. Below is the code for the CSP template

Html.Kendo().Template().AddComponent(tabStrip => tabStrip.TabStrip()
        .Name("ed_${data.TabGuid}")
        .SelectedIndex(0)
        .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
        .HtmlAttributes(new { gridName = "Grid" + id)
        .Events(ev => ev.Activate("tabEvent"))
        .Items(items => items.Add().Text("TabName")
            .LoadContentFrom(Url.Action("ControllerName", "ActionName",
                    new
                    {
                        param= "${data.Property1}",  
                        param1= false,
                        param2= false,
                        param3= false
                    })))
    );

The current URL forming is considering ${data.Property1} as a string in the content URL formed in the kendo deferred script.
Is there any way that it could consider ${data.Property1} as a template literal inside contentUrl?
Alexander
Telerik team
 answered on 05 Jul 2024
1 answer
126 views
I need to control access, through the session credentials of my web application, to some pdf files that IIS has in order to only allow access to said resource if I am logged into the app.
I am researching to implement this with 'Forms Authentication' I don't know if this is the best option or maybe I should consider 'Basic Authentication' or JWT.
Tsvetomila
Telerik team
 answered on 03 Jul 2024
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?