
Untitled
By: a guest on
Jul 31st, 2012 | syntax:
None | size: 0.78 KB | hits: 13 | expires: Never
How can I hide a date value if it is less than current date?
<asp:DropDownList id="eventsDate" runat="server">
<asp:ListItem Value="04/31/2012">Apr 31, 2012</asp:ListItem>
<asp:ListItem Value="05/21/2012">May 21, 2012</asp:ListItem>
<asp:ListItem Value="07/22/2012">Jul 22, 2012</asp:ListItem>
<asp:ListItem Value="10/16/2012">Oct 16, 2012</asp:ListItem>
<asp:ListItem Value="11/12/2012">Nov 12, 2012</asp:ListItem>
<asp:ListItem Value="12/18/2012">Dec 18, 2012</asp:ListItem>
</asp:DropDownList>
var myNewData = (from a in dt.AsEnumerAble() where DateTime.Parse(a["time"])<DateTime.Now.Date.AddDays(1) select a).CopyToDataTable()
eventsDate.Items.Cast<ListItem>().Select(
i => i.Attributes["display"] = DateTime.Parse(i.Value) >= DateTime.Today ? "block" : "none");