Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When click the button i will check the user entered text value is current date or not... if the date is wrong means how to display a message... using asp.net c#
what is code for it....
Posted

1 solution

try this:

C#
string todaydate= DateTime.Now.ToString();

if(todaydate!=todayDate.Text)//todayDate is your textbox
{
  Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('Date entered is incorrect!');", true); 
}

hope it helps :)
 
Share this answer
 
v2
Comments
v surya dev 17-Feb-12 9:18am    
it will through error todayDate.Text... it does not accept the .Text....
Uday P.Singh 22-Feb-12 13:52pm    
todayDate is the name of your textbox and it will accept text.

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