Telerik Forums
UI for ASP.NET Core Forum
1 answer
18 views

Hi there,

After updating to version 2023.3.1114, I found that the calendar at Kendo UI Date Range Picker won't closed automatically after selecting the start and end date. This happened particularly when I change the max date inside the "Change" Event.

$("#date-range-picker").data("kendoDateRangePicker").max(new Date(2024, 1, 14));

I was able to replicate the issue at Kendo UI JQuery dojo: https://dojo.telerik.com/UfOcUZaY/3

However the issue can't be replicated at the following REPL: https://netcorerepl.telerik.com/?_gl=1*12uzyp6*_ga*ODY4MDY0MTk4LjE3MDY0NzY2ODc.*_ga_9JSNBCSF54*MTcwNjQ3NjY4Ni4xLjEuMTcwNjQ3NzM2NC44LjAuMA..*_gcl_au*MTM5NDI2ODE3Ny4xNzA2NDc2Njg3

Turned out the page still using version 2023.3.1010.

Is this change intended?

Is there a workaround? I have tried to close the calendar manually after checking if the range.start and range.end available. But didn't quite work well. It may close the calendar even if I only select the start date.

Appreciate your support. Thank you.

Ivan Danchev
Telerik team
 answered on 31 Jan 2024
2 answers
23 views

I created a custom download with DateRangePicker checked. I have a page with this code:

@(Html.Kendo().DateRangePicker()
    .Name("startEnd")
    .Messages(m => m.StartLabel("Start").EndLabel("End"))
)

When the page loads there is a JavaScript error in the console:

Uncaught TypeError: e._startInput.kendoDateInput is not a function

I created another custom download with DateInput and DateRangePicker checked.

When the page loads there is a different JavaScript error in the console:

Uncaught TypeError: o is not a constructor

I thought the custom download page handled the dependencies. Are there other DateRangePicker dependencies that I need to check?

Thanks

Tim
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 01 Jan 2024
1 answer
183 views

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>

Aleksandar
Telerik team
 answered on 16 Mar 2022
1 answer
85 views
Hello,
I'm starting a daterangepicker for filtering my datas,
as i select the time range,
say like selecting start time: 2021/10/18 to end time: 2021/10/19
while i checked the value it turns out to be 2021/10/18 12:00:00 to 2021/10/19 12:00:00.
The issue here is how can i change the selected value to 2021/10/18 00:00:00 to 2021/10/19 00:00:00?
Aleksandar
Telerik team
 answered on 21 Oct 2021
1 answer
171 views

I have attached the code plus the error message.

 

kendo support us in 2 ways to declare control in razor view.
- @(
Html.Kendo().DatePicker
)
- @{
Html.Kendo().DatePicker()
.Render();
}

 

but with the second if I add HtmlAttribute with 4 attribute inside, it will get error.
 ex: @{
Html.Kendo().DatePicker()
.HtmlAttribute(new {a="id1", b ="id2", c="id3", d="id4"})
.Render();
}
Mihaela
Telerik team
 answered on 07 Jun 2021
3 answers
132 views

I want to change the language of the placeholder from "day/month/year" to "día/mes/año".

Any way, how it can be done?

Greetings

Eyup
Telerik team
 answered on 07 Jan 2021
6 answers
101 views

The Date value submitted to the Controller method from the DateRangePicker control is not compatible with the System.DateTime .NET Type.

DateRangePicker:

<div class="col-sm-6">
    <h6>Date Filter:</h6>
 
    @(Html.Kendo().DateRangePicker()
        .Name("daterangepicker")
        .HtmlAttributes(new { style = "width: 100%" })
        .Events(e => e.Change("onDateRangeChange")))
</div>

Initialize Script:

$(document).ready(function() {
 
    var startDate = $("#startDate").val();
    var endDate = $("#endDate").val();
 
    alert(startDate == null);
    alert(endDate == null);
 
    alert("Start - " + startDate);
    alert("End - " + endDate);
 
    var dateRangePicker = $("#daterangepicker").data("kendoDateRangePicker");
 
    var range = {
        start: startDate,
        end: endDate
    };
 
    dateRangePicker.range(range);
    //dateRangePicker.dateView._current = startDate;
 
    //alert("Start - " + dateRangePicker.range().start);
    //alert("End - " + dateRangePicker.range().end);
});

onDateRangeChange:

function onDateRangeChange() {
 
    var dateRangePicker = $("#daterangepicker").data("kendoDateRangePicker");
    if (dateRangePicker != null) {
 
        var range = dateRangePicker.range();
        if (range != null) {
 
            var startDate = range.start;
            var endDate = range.end;
 
            alert("Start1 - " + startDate);
            alert("End - " + endDate);
 
            $('#startDate').val(startDate);
            $('#endDate').val(endDate);
 
            //dateRangePicker.dateView._current = startDate;
 
            var grid = $("#grid").getKendoGrid();
            grid.dataSource.read();
        }
    }
}

 

Grid Definition:

<div class="col-sm-8">
    <a href="#" onclick="onCreate()">Create New</a>
 
    @(Html.Kendo().Grid<Session>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Command(command => command
                .Custom("Detail")
                .Click("goDetail"))
                .Width(Glossary.Portal.ButtonWidth);
 
            columns.Bound(p => p.Time).Title("Time")
                .Format("{0:hh:dd:mm tt}");
        })
        .Pageable()
        .Sortable()
        .Scrollable()
        .HtmlAttributes(new { style = "height:550px;margin-right:0px;padding-right:0px;" })
        .Selectable()
        .Navigatable()
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(20)
            .Read(read => read.Action("IndexJson", "Sessions")
                .Data("gridGetData"))))
</div>

gridGetData:

function gridGetData() {
 
    var groupId = $('#groupId').val();
    var startDate = $('#startDate').val();
    var endDate = $('#endDate').val();
 
    alert("Start1 - " + startDate);
    alert("End - " + endDate);
    alert("groupId - " + groupId);
 
    //var isoStartDate = startDate.toISOString();
    //var isoEndDate = endDate.toISOString();
 
    //alert("Start2 - " + isoStartDate);
    //alert("End - " + isoEndDate);
 
    var data = {
        customerId: customerId,
        customerUniqueId: customerUniqueId,
        startDate: startDate,
        endDate: endDate,
        groupId: groupId,
        personId: personId
    };
 
    alert("Start3 - " + data.startDate);
    alert("End - " + data.endDate);
 
    return data;
}

Controller:

public async Task<IActionResult> IndexJson(
    [DataSourceRequest] DataSourceRequest request,
    int customerId,
    string customerUniqueId,
    DateTime startDate,
    DateTime endDate,
    int? groupId,
    int? personId)
{
    if (customerId == 0)
    {
        throw new Exception(
            $"Invalid {nameof(customerId)} parameter value.");
    }
 
    if (startDate == DateTime.MinValue ||
        endDate == DateTime.MinValue)
    {
        throw new Exception(
            $"Invalid {nameof(startDate)} or {nameof(endDate)} parameter values.");
    }

 

...

Attempt1:

Populate grid, initialize with DateTime parameter type

See attached files: 

- Annotation 2020-05-05 1.png - This is what happens the first time the grid.Read method is called

- Annotation 2020-05-05 alert.png - This shows the same alert from the gridGetData method 1st attempt then after the onDateRangeChange is called.

onDateRangeChange:  Nothing.  The Controller is not called

Attempt2:

Populate grid, initialize with string parameter type

I changed the Controller.IndexJson method's Parameter from DateTime to String DataType

At this point, the gridGetData successfully fired the Controller method and the string value given matched what was on the "Annotation 2020-05-05 alert.png" right side.  On DateTime.TryParse, the value was not compatible with .NET.

Thanks in advance for your help,

Joel

 

 

Joel
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 14 May 2020
3 answers
62 views

When given a legit value on startup, value is not represented.

DateRangePicker:

<div class="col-sm-6">
    <h6>Date Filter:</h6>
 
    @(Html.Kendo().DateRangePicker()
        .Name("daterangepicker")
        .HtmlAttributes(new { style = "width: 100%" })
        .Events(e => e.Change("onDateRangeChange")))
</div>

Form Fields:

<form>
    <div asp-validation-summary="ModelOnly" class="text-danger"></div>
    <input type="hidden" id="customerId" asp-for="CustomerId" />
    <input type="hidden" id="customerUniqueId" asp-for="CustomerUniqueId" />
    <input type="hidden" id="groupId" asp-for="GroupId" />
    <input type="hidden" id="personId" asp-for="PersonId" />
    <input type="hidden" id="startDate" asp-for="StartDate" />
    <input type="hidden" id="endDate" asp-for="EndDate" />
</form>

Initialize Script:

$(document).ready(function() {
 
    var startDate = $("#startDate").val();
    var endDate = $("#endDate").val();
 
    alert(startDate == null);
    alert(endDate == null);
 
    alert("Start - " + startDate);
    alert("End - " + endDate);
 
    var dateRangePicker = $("#daterangepicker").data("kendoDateRangePicker");
 
    var range = {
        start: startDate,
        end: endDate
    };
 
    dateRangePicker.range(range);
    //dateRangePicker.dateView._current = startDate;
 
    //alert("Start - " + dateRangePicker.range().start);
    //alert("End - " + dateRangePicker.range().end);
});

Controller:

model.StartDate = DateTime.Today.Date.AddDays(-10);
model.EndDate = DateTime.Today.Date.AddDays(5);
Viktor Tachev
Telerik team
 answered on 13 May 2020
3 answers
205 views

Hello,

I am working with using a DateRangePicker with the calendar section always open and I have it in a sidebar. The problem I am having is that the calendar portion does not resize to fit the space it should be contained within. The multiselect I have in the same div work as expected and size down when the size of the window goes down but the calendar of the DateRangePicker instead stays the same size and starts to cover other elements on the page. Any ideas on how I could make the calendar resize properly?

 

Thanks,

Alex

Eyup
Telerik team
 answered on 10 Jul 2019
2 answers
284 views

Hello,

 

I am wondering if there is any way to customize the DateRangePicker to allow for it to have the two calendar months stacked vertically when it is opened. I am looking to use the range picker in a sidebar on my page and it would fit much better vertically than the default horizontal. 

 

Thank you

Teya
Telerik team
 answered on 04 Jul 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?