当我使用C#单击按钮时如何检查用户输入的文本框值是当前日期
问题描述:
当单击按钮时,我将检查用户输入的文本值是否为当前日期...如果日期错误,则意味着如何显示消息...使用asp.net c#
它的代码是什么....
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....
答
尝试一下:
try this:
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 :)