title: JQuery Date Picker in ASP.NET
body: <p>I have a button in my page. When I click it, it should open a JQuery window.</p>
  
  <p>Inside the window, I have a datepicker control, which by default should show the current date. My code is like so.</p>
  
  <p><strong>CLIENT SIDE</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    $(function () {
        $("#&lt;%= txtDate.ClientID %&gt;").datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: "dd-mm-yy",
            yearRange: '1901:2050',
            maxDate: new Date(),
            showOn: "button",
            buttonImage: "images/calendar.png",
            buttonImageOnly: true,
            showButtonPanel: true,
            showMonthAfterYear: true,
            inline: true,
            altField: "#&lt;%= HiddenDate.ClientID %&gt;",
            altFormat: "dd-mm-yy",
            onSelect: function (dateText, inst) {
                shouldsubmit = true;
            },
            onClose: function (dateText, inst) {
                shouldsubmit = false;
                javascript: __doPostBack('&lt;%= txtDate.ClientID %&gt;', '');
            }
        });
  
  Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function (evt, args) {
          $("#&lt;%= txtDate.ClientID %&gt;").datepicker({
              changeMonth: true,
              changeYear: true,
              dateFormat: "dd-mm-yy",
              yearRange: '1901:2050',
              maxDate: new Date(),
              showOn: "button",
              buttonImage: "images/calendar.png",
              buttonImageOnly: true,
              showButtonPanel: true,
              showMonthAfterYear: true,
              inline: true,
              altField: "#&lt;%= HiddenDate.ClientID %&gt;",
              altFormat: "dd-mm-yy",
              onSelect: function (dateText, inst) {
                  shouldsubmit = true;
              },
              onClose: function (dateText, inst) {
                  shouldsubmit = false;
                  javascript: __doPostBack('&lt;%= txtDate.ClientID %&gt;', '');
              }
          });
      });
  </code></pre>
  
  <p><strong>SERVER SIDE</strong></p>
  
  <pre><code>If Not Page.IsPostBack Then
          TxtDate.Text = DateTime.Today.ToString("dd-MM-yyyy")
          TxtDate.Text = Session("CurrentDate")
  End If
  </code></pre>
  
  <p>But the textbox remains blank. Any clues as to where I am wrong?</p>