We help IT Professionals succeed at work.
Get Started

How to remove repeating items from DropDown?

pawar_deepak
pawar_deepak asked
on
706 Views
Last Modified: 2012-05-10
Hello,

I am adding items to dropdown on Page Load.

if (system == "aaa")
            {
                ddlSystem.Items.Add("");
                ddlSystem.Items.Add("aa");
                ddlSystem.Items.Add("bb");              
            }

else if (system == "xxx")
            {
                ddlSystem.Items.Add("");
                ddlSystem.Items.Add("xx");
                ddlSystem.Items.Add("yy");              
            }

On postback, the dropdown shows repeating values like

aa
bb
aa
bb

instead of just
aa
bb

Each time there is a postback, dropdown gets a new set of repeating items. How can I make dropdown to show only aa, bb and not the repeating set of items?

Comment
Watch Question
Technical Analyst
Commented:
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE