0

My jquery version

<script src="scripts/jquery-1.4.4.js"></script>
<link href="scripts/jquery-ui.css" rel="stylesheet" />
<script src="scripts/jquery-ui.js"></script>

and this javascript code

$("#Textdate2").datepicker({ dateFormat: 'dd/mm/yy', 
                             isBuddhist: true, defaultDate: toDay })

If have defaultDate: toDay when I click on textbox nothing happens, but If toDay change to null, It still an en calendar what I need to do ?

2 Answers2

0

in asp.net the Id of the control is change when is render on page, so with this code

<asp:TextBox ID="Textdate2" runat="server" Width="30%" Height="5%" ></asp:TextBox>

you need to write

$("#<%=Textdate2.ClientID%>").datepicker({ dateFormat: 'dd/mm/yy', 
                             isBuddhist: true, defaultDate: toDay })

to actually capture it.

Related:
Accessing control client name and not ID in ASP.NET
How to get asp.net client id at external javascript file

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150
-1

may be u dint add the html or library missing please check

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
$("#datepicker").datepicker({ dateFormat: 'dd/mm/yy', isBuddhist: true, 
defaultDate: new Date()})

  });
  </script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>


</body>
</html>
Gayathri Mohan
  • 2,924
  • 4
  • 19
  • 25