TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sowjanya
NA
2
0
Drop down list
Mar 20 2010 2:26 AM
Hi i was given some coding in my institute which I am unable to understand.It is regarding creating user defined drop down list of languages spoken that are supported by os...can you please explain me the coding of it clearly....
public class CultureDropdown : DropDownList
{
protected override void OnLoad(EventArgs e)
{
if (!Page.IsPostBack)
{
SortedList lst = getAvailableCultures();
DataSource = getAvailableCultures();
DataValueField = "Value";
DataTextField = "Key";
DataBind();
}
}
private SortedList getAvailableCultures()
{
SortedList results = new SortedList();
string[] languages = ((string)((IDictionary)
WebConfigurationManager.GetSection("supportedLanguages"))["languages"]).Split(',');
foreach (string language in languages)
{
foreach (CultureInfo specific in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
if (specific.TwoLetterISOLanguageName == language)
{
results.Add(specific.DisplayName, specific.Name);
}
}
}
return results;
}
Thanks in advance
Reply
Answers (
1
)
Thumbnail viewer control in vs2005?
Facial expression recognition using c#