Need to get the Newest added Item To Display in Texboxes and Labels
try
{
using (SPSite site = new SPSite("http://wingtip:49074"))
{
TextBoxContents.Visible = true;
TextBoxContents2.Visible = true;
LabelShowTitle.Text = string.Empty;
TextBoxContents.Text = string.Empty;
LabelShowDatum.Text = string.Empty;
LabelAuthor.Text = string.Empty;
LabelLink.Text = string.Empty;
SPWeb web = SPContext.Current.Web;
SPList list = web.Lists.TryGetList(DropDownListSelectCategory.SelectedItem.Value);
SPListItemCollection items = list.GetItems();
TextBoxContents2.Text = items[0]["Contents"].ToString();
LabelShowTitle2.Text = items[0]["Title"].ToString();
LabelShowDatum2.Text = items[0]["Date"].ToString();
LabelAuthor2.Text = items[0]["Authors"].ToString();
LabelLink2.Text = new SPFieldUrlValue(items[0]["Links"].ToString()).Url;
TextBoxContents.Text = items[1]["Contents"].ToString();
LabelShowTitle.Text = items[1]["Title"].ToString();
LabelShowDatum.Text = items[1]["Date"].ToString();
LabelAuthor.Text = items[1]["Authors"].ToString();
LabelLink.Text = new SPFieldUrlValue(items[1]["Links"].ToString()).Url;
}
}
Even how many items add in my List i what it to display the latest added someone now how to do that ? and also the old ones. I what the latest added item in the List to Update the Textboxes and Labels