Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1740
How do I unbind a WebDropDown?
posted

How do I unbind a WebDropDown? I have WebDropDown that is bound to a dataset. Now on a condition, I have to clear the datasource or show it empty.

Simple code does not work!

WebDropDown1.DataSource = null;

WebDropDown1.DataBind();

I would appreciate any help from the user community.

Thanks

Parents
No Data
Reply
  • 24671
    Suggested Answer
    posted

    Hi,

    Instead of setting the DataSource to "null", you should set it to an empty data source, for example if you bind to a list, 

     

    WebDropDown1.DataSource = new List<MyClass>();

    Thanks,

    Angel

Children