We help IT Professionals succeed at work.
Get Started

asp combo box

JCWEBHOST
JCWEBHOST asked
on
452 Views
Last Modified: 2012-06-27
hey guys i am having problem with clearing a asp combo box.

here is whats happening:

when i excute items.clear() it clear the items in the combo box but i have to click the combo box than the items get clear. if i do not click the text area the item that was selected remains there.

i looked in the internet and found some thing

http://forums.asp.net/t/1434914.aspx 

it works fine for clearing 1 combo box, but i have 2 and more.

here my code:

            ddRegion.Items.Clear();
            Clear(ddRegion);
            ddArea.Items.Clear();
            Clear(ddArea);


    public void Clear(Control ComboBox)
    {
        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Script", "function pageLoad() { $find('" + ComboBox.ClientID + "').get_textBoxControl().value = ''; }", true);
    }


i think why it is not clearing the other two is because of the

pageLoad()   cause of the page only loaded once


can any one help me?
Comment
Watch Question
This problem has been solved!
Unlock 2 Answers and 6 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