Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
How to disable JqueryDateTime Picker Image button .
But textbox i can disable ,I can't do Image button.

here code i am try it.

C#
function disableDate() {
    debugger;
    document.getElementById('txtStartDate').disabled = true;
    $get('txtStartDate').style.color = "gray";
    $get('txtStartDate').disabled = true;




    $('txtStartDate').datepicker('disable');

    $('txtStartDate').datepicker('setDate', new Date()).datepicker('disable').blur();


    $('txtStartDate').disableSelection = true;


}


C#
<input id="txtStartDate"  runat="server" class="TextBox DatePicker" 
                                            style="width: 125px" />


script:

C#
        <style>
 .ui-datepicker-trigger
        {
            position: relative;
            top: 4px;
            right: -3px;
            height: 17px;
        }
        </style>
        <script language="javascript" type="text/javascript">
            var Dformat = "";
            $(document).ready(function () {
                var selectvalStartDate = $("#txtStartDate").val();
                var sVal = document.getElementById('hdnPORTALID').value;
                Dformat = GetDatePickerFormat(sVal);
                $(".DatePicker").attr("placeholder", "Select date").datepicker({
                    showOn: "both",
                    buttonImage: "../images/datepicker_enable.png",
                    buttonImageOnly: true,
                    changeMonth: true,
                    changeYear: true,
                    dateFormat: Dformat
                });

            });
</script>


thanks,
Karthikeyan,
Posted
Updated 1-May-14 21:30pm
v2
Comments
Bh@gyesh 2-May-14 5:04am    
Hi,

Get your imagebuttons exact id (i.e. like 'ctl00_ContentPlaceHolder1_ImageButton1') and add below line in document.ready event :

document.getElementById('ctl00_ContentPlaceHolder1_ImageButton1').style.visibility = "hidden";
pkarthionline 2-May-14 5:22am    
but i need disable.i don't need hidden.how to write code?

1 solution

Hai

Try this code to disable the datepicker.

"#from" is Element id name

$( "#from" ).datepicker( "option", "disabled", true );
 
Share this answer
 
Comments
pkarthionline 2-May-14 6:17am    
i can't do image this disable.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900