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
close icon

Hide datepicker in javascript code

Hi,

I want hide/show a datepicker control in function dropdownlist value

<ej:DropDownList runat="server" ID="ddlTemporalidad" Value="2" ClientSideOnChange="onTemporalidadChange">

<ej:DatePicker runat="server" ID="dateDiario"></ej:DatePicker>


        function onTemporalidadChange(args)
        {
            switch(args.value)
            {
                case "1":
                    var obj = $("#<%=dateDiario.ClientID%>").data("ejDatePicker");
                    obj.show();                 
                    break;
                case "2":
                    var obj = $("#<%=dateDiario.ClientID%>").data("ejDatePicker");
                    obj.hide();                  
                    break;
                ...............
             }
        }


But it doesn't work

1 Reply

FP Francis Paul Antony Raj Syncfusion Team May 31, 2016 02:13 PM UTC

Hi Manolo, 
 
Thanks for contacting Syncfusion support. 
 
We have checked with your code snippet and tried with your code example. ClientSideOnChange event triggers properly when select the items in the dropdownlist and correspondingly datepicker show(), hide() method works. For your convenience, we have attached the sample in the below location. 
 
If still you face any difficulties, please check, 
#1) whether any script error thrown in console window. 
#2) whether ClientSideOnChange event triggers properly. 
#3) if triggers, check with the argument value (args.value), whether it is a string or integer type and changed the code accordingly. 
 
Please revert back the sample to reproduce the issue at our end, if still problem persists. 
 
Regards, 
Francis Paul A 


Loader.
Live Chat Icon For mobile
Up arrow icon