Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
ASP.NET
<script>
function checkDate(sender,args)
{
    if (sender._selectedDate < new Date())
    {       
        alert("You cannot select a day earlier than today!");
        sender._selectedDate = new Date(); 
        // set the date back to the current date
        sender._textbox.set_Value(sender._selectedDate.format(sender._format))
     }
}
</script>

<asp:TextBox ID="txtbox" runat="server" Enabled="false" Font-Names="Calibri" Font-Size="Medium" Height="20px" TabIndex="20" Width="175px" MaxLength="11">

<asp:CalendarExtender ID="CalendarExtender2" runat="server" Format="dd/MMM/yyyy" TargetControlID="txtbox" OnClientDateSelectionChanged="checkDate" />

if i select today also it is showing alert message how to solve
can you please tell me
Posted
Updated 31-Mar-15 22:01pm
v3
Comments
Tushar sangani 1-Apr-15 4:47am    
what is problem in above code?
Parazival 1-Apr-15 4:50am    
if i select today also

it is showing alert message and selected date today only but
i don't wanna show alert message when i select today
King Fisher 1-Apr-15 6:10am    
then, when do you want to show alert message?
Parazival 1-Apr-15 6:24am    
k k sorry for asking this question i got a solution for that

1 solution

just keep alert message in comment that's it k k
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900