private void SortDDL(ref DropDownList myddl)
{
ArrayList textList = new ArrayList();
ArrayList valueList = new ArrayList();
foreach (ListItem li in myddl.Items)
{
textList.Add(li.Text);
}
textList.Sort();
textList.Reverse();
foreach (object item in textList)
{
string value = myddl.Items.FindByText(item.ToString()).Value;
valueList.Add(value);
}
myddl.Items.Clear();
for (int i = 0; i < textList.Count; i++)
{
ListItem objItem = new ListItem(textList[i].ToString(), valueList[i].ToString());
myddl.Items.Add(objItem);
}
}
Thursday, October 28, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment