public static void RemoveDuplicateItems(DropDownList ddl)
{
for (int i = 0; i < ddl.Items.Count; i++)
{
ddl.SelectedIndex = i;
string str = ddl.SelectedItem.ToString();
for (int counter = i + 1; counter < ddl.Items.Count; counter++)
{
ddl.SelectedIndex = counter;
string compareStr = ddl.SelectedItem.ToString();
if (str == compareStr)
{
ddl.Items.RemoveAt(counter);
counter = counter - 1;
}
}
}
}
4 comments:
Thank you Very much this has helped me a lot.
Vuyiswa Maseko
Thanks for sharing
thanks U It working greattttttt job
who to write method
because i copy/ paste
no slove problem
please help me
Post a Comment