aspx_professional thread: getting the most current itmes which has sorted by data
let me send it as complete :
here what I have ....
DateTime dtOneWeekAgo = DateTime.Now;
dtOneWeekAgo = dtOneWeekAgo.AddDays(-7);
m_calAfter.SelectedDate = dtOneWeekAgo;
DoSearch();
DoSearch is doing this :
private void DoSearch()
{
//gets all docs for this category, then queries
// based on the form input parameters
ManagersDB oManagersDB = new ManagersDB();
DataTable dtDocs = oManagersDB.GetManagerDocs
(Convert.ToInt32(m_selCategories.SelectedItem.Value));
//develop query string
string sQuery = m_radSearch.SelectedItem.Value+"
like '%"+m_txtSearch.Text+"%' and
PostDate>'"+m_calAfter.SelectedDate.ToShortDateString()+"'";
dtDocs.DefaultView.RowFilter = sQuery;
//databind to realize query
m_rptDocs.DataSource = dtDocs;
m_rptDocs.DataBind();
//if table empty, display message, else display
results
if (((DataTable)
(m_rptDocs.DataSource)).DefaultView.Count>0)
{
m_rptDocs.Visible=true;
m_lblNotFound.Visible = false;
}
else
{
m_rptDocs.Visible=false;
m_lblNotFound.Visible = true;
}
Now pls tell me ..how can I get the most recent news for at most 5 itmes.
guys
> I have a news page which shows us our news in the last 7 days.
i> f I have some news in this last 7 days it shows up but I want to do
s> omething to get the most current news in my list.for example just 5 of
t> he most currnet news.
h> ere is what I did to get the news in the last 7 days.
> DateTime dtOneWeekAgo = DateTime.Now;
> dtOneWeekAgo = dtOneWeekAgo.AddDays(-7);
> m_calAfter.SelectedDate = dtOneWeekAgo;
> DoSearch();
>
> Thanx so much