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

using System;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using System.Collections.Specialized;
using CommunityServer.Configuration;

namespace CommunityServer.Controls
{
	/// <summary>
	/// Summary description for FilterLanguageDropDownList.
	/// </summary>
	public class FilterLanguageDropDownList : DropDownList 
	{
		public FilterLanguageDropDownList() 
		{
			Items.Add(new ListItem(ResourceManager.GetString("FilterLanguage_None"), ""));

			foreach (FilterLanguage fl in CSConfiguration.GetConfig().FilterLanguages) 
			{
				Items.Add(new ListItem(fl.Name, fl.Key));
			}
		}

		public override string SelectedValue
		{
			get
			{
				return base.SelectedValue;
			}
			set
			{
				if (this.Items.FindByValue(value) == null)
					base.SelectedValue = "";
				else
					base.SelectedValue = value;
			}
		}

	}
}
