Comonbox SelectIndexChanged Event not getting fired.


I have a combo box with a SelectIndexChanged event. When I write this statement :

this._cboGroup.SelectedIndex = 0;

The event is not getting fired. This code goes after page post back. I made my combobox postback property to ture. But If I select directly from the combobox, it work, it won't work if I assign the value in the code. Please let me know what I can do to get this event fired.

Thanking you,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeff CertainCommented:
Doesn't work that way in ASP .net. The new object-oriented model is client-side event-driven. You're not creating a client-side event, so you need to explicitly call the SelectedIndexChanged event to make it work the way you think it should...

this._cboGroup.SelectedIndex = 0;
_cboGroup_SelectIndexChanged(null, null);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
check in ur page laod event, u may be filling that combo everytime page postback, or first try to make it last statement in page load ,this._cboGroup.SelectedIndex = 0;
, it will work
Jeff CertainCommented:
Also, FWIW, SelectedIndex = 0 is the first itme in the list, not "nothing selected". If oyu want to have nothing selected, you need to set SelectedIndex = -1.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.