Displaying news by custom field
Hi I am trying to create a dropdown in news widget using date, so that when I select the date from dropdown it displays news from that date forward. My approach was to add asp control for dropdown
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="itemSelected" ></asp:DropDownList>
In code behind I populated the dropdown
protected void Page_Load(object sender, EventArgs e)
if(!Page.IsPostBack)
int thisYear = Convert.ToInt32(System.DateTime.Now.Year);
for(int i=2012; i<=thisYear; i++)
DropDownList1.Items.Add(new ListItem(i.ToString(), i.ToString()));
ListItem lsitem = new ListItem("Select Year Range", "0");
DropDownList1.Items.Insert(0, lsitem);
Than when item is selected from dropdown it calls following method in code behind
protected void itemSelected(object sender, EventArgs e)
I want to know if the approach is correct, if so than how to access the news by that year?
Thanks