user519670
user519670

Reputation: 685

asp.net jquery datepicker not working

im new to javascript and Jquery and i just cant seem to get this working. I believe the problem in specific is the reference to the jquery files thats not working but i could be wrong. Below is the relavent code.

<head runat="server">
<title>Expense Report Admin Portal</title>
<link rel="stylesheet" type="text/css" href="Content/admin.css" />
<%--<script type="text/javascript" src="Scripts/jquery-ui-1.11.4/jquery-ui.js"></script>--%> 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>


<script>
$(function() {
  $( '#<%=datepicker.ClientID%>' ).datepicker();

});
</script>

</head>



<asp:TableCell>
      <asp:TextBox ID="datepicker" runat="server"></asp:TextBox>
                            </asp:TableCell>

Upvotes: 0

Views: 39

Answers (2)

Fouad
Fouad

Reputation: 131

i think you comment jquery reference. uncomment this line. the belwo example work for me.

include => jquery-ui.css include => jquery-1.10.2.js include => jquery-ui.js

<!doctype html>
 <html lang="en">
 <head>
   <meta charset="utf-8">
   <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com 
  ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
   <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js">
 </script>
 <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
   $(function() {
     $( "#datepicker" ).datepicker();
  });
   </script>
</head>
<body>

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


 </body>
 </html>

Upvotes: 0

user519670
user519670

Reputation: 685

I was right, there was something wrong with the jquery references. I took Igor's advice above, and while i didnt copy ALL the code, i did replace all my references to jquery with the one in the example and it worked.

Upvotes: 1

Related Questions