Question: Need help on this. I cannot disable my date picker in jquery. I did my research already but to no avail. Below is the code which does not enable/disable the datepicker.
[UPDATED]

```
    <script type="text/JavaScript">
    function pageLoad() {

        $(function () {
            $('#<%=TextBox_EventStartDate.ClientID %>').datepicker({
                showOn: 'button',
                buttonImage: '../Images/CalendarIcon1.gif',
                changeMonth: true,
                changeYear: true,
                buttonImageOnly: true,
                dateFormat: 'dd/mm/yy'
            });

        });

        $(function () {
            $('#<%=TextBox_EventEndDate.ClientID %>').datepicker({
                showOn: 'button',
                buttonImage: '../Images/CalendarIcon1.gif',
                changeMonth: true,
                changeYear: true,
                buttonImageOnly: true,
                dateFormat: 'dd/mm/yy'
            });
        });

        $("#<%=CheckBox_PayEvent.ClientID %>").click(function () {
            if ($("#<%=CheckBox_PayEvent.ClientID %>").is(":checked")) {
                $("#<%=TextBox_EventStartDate.ClientID %>").attr('readonly', true);
                $("#<%=TextBox_EventStartDate.ClientID %>").datepicker("disable");

                $("#<%=TextBox_EventEndDate.ClientID %>").attr('readonly', true);
                $("#<%=TextBox_EventEndDate.ClientID %>").datepicker("disable");
            }
            else {
                $("#<%= TextBox_EventStartDate.ClientID %>").attr('readonly', false);
                $("#<%= TextBox_EventStartDate.ClientID %>").datepicker("enable");

                $("#<%= TextBox_EventEndDate.ClientID %>").attr('readonly', false);
                $("#<%= TextBox_EventEndDate.ClientID %>").datepicker("enable");
            }
        });
    }

</script>

```

Thanks for the help!

Answer: 
A little late with this answer but in case this is helpful for anyone else, I stumbled across this same issue and the common solution posted online ***.datepicker("disable")*** did not work for me either

I looked over the datePicker source and found the following, which did work for me. Maybe the correct answer is version dependent.

To disable control

```
$("#<%= TextBox_EventStartDate.ClientID %>").dpSetDisabled(true); 

```

To enable control

```
$("#<%= TextBox_EventStartDate.ClientID %>").dpSetDisabled(false); 

```
using ({disabled: true}) definitely does not work, datepicker("disable") is what will do it.

Are you sure that the conditional statement is being met and the click event is being fired; are you sure the code is running?

Is it possible the space is being echoed by the server side code, so that ID being passed to JQuery is like this: "# ElementID"?