Reputation: 921
I want to disallow the previous dates in calendar extender. I'm able to show pop up when previous date is selected, but textbox is not clearing.
<script type="text/javascript">
function checkDate(sender, args) {
if (sender._selectedDate < new Date()) {
alert("You cannot select a day earlier than today!");
sender._selectedDate = new Date();
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
document.getElementById("txtNextFollowupDate").value = "";//want to make empty
}
}
</script>
<tr>
<td><asp:Label ID="Label18" Text="Next Follow up date" runat="server"></asp:Label></td>
<td>:</td>
<td>
<asp:TextBox runat="server" ID="txtNextFollowupDate" />
<asp:CalendarExtender ID="CalendarNextFollowUpDate" runat="server" TargetControlID="txtNextFollowupDate" OnClientDateSelectionChanged="checkDate" > </asp:CalendarExtender>
</td>
</tr>
Upvotes: 2
Views: 437
Reputation: 8271
you need to Clear the Textbox value using :
document.getElementById("<%=txtNextFollowupDate.ClientID %>").value=" ";
Upvotes: 1