Reputation: 295
I'm trying to display an announcement on website. I hope it can automatically stop showing on, say Feb 1st 2014. Anybody knows how to implement it?
Upvotes: 0
Views: 112
Reputation: 14253
ASPX:
<img id="ann" src="../img/banner.jpg" alt="ann" runat="server" Visible="false"/>
Code behind:
if(DateTime.Now< new DateTime(2014,2,1))
ann.Visible= true;
Upvotes: 0
Reputation: 6903
Use the following code in page_load of your page:
yourAnnouncementControl.Visible = (DateTime.Now < DateTime.Parse("2014/02/01"));
Be careful about DateTime
format in parse method.
Upvotes: 1