I have got a news control which displays a news article when the id is selected and returned into the url. The problem is that if i go to the page without the id parameter in the url then the page is blank. What I want to do is display the latest news article if no id is selected. I have hacked it atm to display id 157. Any help would be great. Thanks
protected Article _article;
protected Article Article
{
get
{
if (null == _article && null != Request.QueryString["id"])
{
_article = Article.GetById(Int64.Parse(Request.QueryString["id"]));
}
else
{
_article = Article.GetById(Int64.Parse("157"));
}
return _article;
}
}
From what i understood, you need to keep track of what is the latest ID. And make use of it here instead of "157".
when ever latest news is published store the new id make it accessible to above code snippet you have shared. Possible ways i think ,
if my understanding of your problem is not right. please elaborate your question