Display weekday in textbox or label using date from textbox
- by Niels Schultz
I have a textbox with calendar extender and a label
<label for="<%= tbxFrom.ClientID %>">
From</label>
<asp:Label ID="lblWeekDayFrom" runat="server"></asp:Label>
<asp:TextBox ID="tbxFrom" runat="server" CssClass="Calendar"></asp:TextBox>
<cc1:CalendarExtender ID="extTbxFrom" runat="server" TargetControlID="tbxStartTag">
</cc1:CalendarExtender>
and now I would like to show the weekday of the currently selected date, either using a formatting inside the textbox like
Th 05/20/2010
or showing the weekday as string using the label on the left side of the texbox (lblWeekDayFrom). There is a calendarExtender to select the date, but I would also like to be able to have the users enter the date manually.
I tried to use JQuery to capture changes, but the label is not showing anything, and it triggers the RequiredFieldValidator on every initial page load.
$(document).ready(function()
{
$('#<%= tbxFrom.ClientID %>').change(updateDate($('#<%= tbxFrom.ClientID %>').val()))
}
);
function updateDate(date)
{
$('#<%= lblWeekDayFrom.ClientID %>').val(date);
}