本文介绍了如何在特定日期启用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have an asp button. When i click this button it will be disabled. I want it to enable on a particular date of every month. How will i do? Please help. Thanks in advance.
我的尝试:
我搜索过谷歌。但我没有找到它。
What I have tried:
I have searched google. but i did not find it.
推荐答案
DateTime dt = DateTime.Now;
// Change "5" to the day you are interested in
if (dt.Day == 5)
{
// enable button
}
else
{
// disable button
}
protected void Page_Load(object sender, EventArgs e)
{
int dayToEnable = 10; // 10th of every month
btnID.Enabled = false;
if (DateTime.Today.Day == dayToEnable)
btnID.Enabled = true;
}
这篇关于如何在特定日期启用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!