if (ddfreshness.SelectedItem.ToString() == "Any") { BindDataList(); } else if (ddfreshness.SelectedItem.ToString() == "30 Days") { foreach (DataListItem dli in DataList1.Items) { //fetching posted date from datalist Label l45 = (Label)dli.FindControl("lblprloc2"); DateTime now = DateTime.Today; TimeSpan ts = now - Convert.ToDateTime(l45.Text); // Difference in days. int differenceInDays = ts.Days; string date = Convert.ToString(differenceInDays) + " Days"; if (differenceInDays <= 30) { //bind fuction for the data to same datalist BindDataList(); } } }
Collection was modified; enumeration operation may not execute
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)