Pretty simple, here is the js:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$("[id$=txt_Date]").datepicker({
});
});
//Set the default date today
$(document).ready(function () {
var currentDate = new Date();
$("#txt_Date").datepicker("setDate", currentDate);
});
</script>
Here is the control on the page. The page has a master page and in the content area the control is nested in an asp:Table, asp:TableRow, asp:TableCell structure.
<asp:TextBox ID="txt_Date" columns="30" runat="server" ReadOnly="true" name="RequestDate"></asp:TextBox>
Here is the code behind where I attempt to capture the value on a submit_click:
Date = Convert.ToDateTime(Request.Form["txt_Date"]);
I have also tried:
Date = Convert.ToDateTime(Request.Form["RequestDate"]);
Every attempt has returned 01/01/0001 as the date which I am guessing is just the default when it reads a NULL value from the control I am sure this is probably simple but I must be missing it.
txt_Date.Value?