We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to write select function in datepicker

Thread ID:





148991 Nov 11,2019 10:40 AM UTC Feb 17,2020 01:41 PM UTC ASP.NET Core - EJ 2 3
Tags: DatePicker
Krishna Prasad
Asked On November 11, 2019 10:40 AM UTC


I have Datepicker in ejs.I need to get data based on selected date. onChange is also not working for me.How to get value on selection of date.

<ejs-datepicker floatLabelType="Auto" ejs-for="@Model.Calender" id="Calender" value="@Model.Calender" name="calender" content="@(Localizer["Calender"].Value)" placeholder="@Html.DisplayNameFor(m=>m.Calender)"></ejs-datepicker>

Sureshkumar P [Syncfusion]
Replied On November 12, 2019 10:49 AM UTC

Hi Krishna, 
Greetings from Syncfusion support. 
With shared code, we have validated your query and suspect that your sample does not properly bind our change event as shown in our sample code below. We would like to suggest the datepickerFor control which doesn’t need to attach the name attribute. We set the attribute of the name based on the value of the binding model. 
Kindly refer to the below code block 
@model Syncfusion_EJ2_Core_App.Controllers.dateValue 
<form method="post"> 
    <ejs-datepicker floatLabelType="Auto" ejs-for="@Model.Calender" id="Calender" value="@Model.Calender" 
        name="calender" placeholder="@Html.DisplayNameFor(m=>m.Calender)" change="OnChange"></ejs-datepicker> 
    <button id="submit">Submit</button> 
    function OnChange(args) { 
We have created a sample based on your requirement. Please find the sample here: https://www.syncfusion.com/downloads/support/forum/148991/ze/Syncfusion_EJ2_Core_App_148991-1121203544  
Sureshkumar P 

Alan Baljeu
Replied On February 14, 2020 10:33 PM UTC

I find that when I click the dropdown button, onChange is firing already.  I need onChange to happen only when I click a date.

Sureshkumar P [Syncfusion]
Replied On February 17, 2020 01:41 PM UTC

Hi Alan, 
We have validated your requirement. we cannot reproduce the reported issue. In our datepicker the change event will trigger while selecting the date value in the calendar. Please check the below video demonstration. 
Sureshkumar P 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon