Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 31st, 2012  |  syntax: None  |  size: 0.78 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How can I hide a date value if it is less than current date?
  2. <asp:DropDownList id="eventsDate" runat="server">
  3.    <asp:ListItem Value="04/31/2012">Apr 31, 2012</asp:ListItem>
  4.    <asp:ListItem Value="05/21/2012">May 21, 2012</asp:ListItem>
  5.    <asp:ListItem Value="07/22/2012">Jul 22, 2012</asp:ListItem>
  6.    <asp:ListItem Value="10/16/2012">Oct 16, 2012</asp:ListItem>
  7.    <asp:ListItem Value="11/12/2012">Nov 12, 2012</asp:ListItem>
  8.    <asp:ListItem Value="12/18/2012">Dec 18, 2012</asp:ListItem>
  9. </asp:DropDownList>
  10.        
  11. var myNewData = (from  a in dt.AsEnumerAble() where DateTime.Parse(a["time"])<DateTime.Now.Date.AddDays(1) select a).CopyToDataTable()
  12.        
  13. eventsDate.Items.Cast<ListItem>().Select(
  14.     i => i.Attributes["display"] = DateTime.Parse(i.Value) >= DateTime.Today ? "block" : "none");