//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.Components.Enumerations;

namespace CommunityServer.Controls
{
	public class PostsSortDropDownList : DropDownList
	{

		public PostsSortDropDownList() 
		{

			Items.Add(new ListItem(CommunityServer.Components.ResourceManager.GetString("PostsSortDropDownList_OldToNew"), ((int) PostSortBy.OldToNew).ToString()));
			Items.Add(new ListItem(CommunityServer.Components.ResourceManager.GetString("PostsSortDropDownList_NewToOld"), ((int) PostSortBy.NewToOld).ToString()));

		}

		public new PostSortBy SelectedValue 
		{
			get { return (PostSortBy) int.Parse(base.SelectedValue); }
			set 
			{ 
				// Deselect current item
				Items.FindByValue( base.SelectedValue ).Selected = false;
				Items.FindByValue( ((int) value).ToString() ).Selected = true; 
			}
		}

	}
}
