Solved

Override textchanged on dropdownlist to not fire on databinding

Posted on 2011-03-02
3
690 Views
Last Modified: 2012-05-11
Hello

In a winform app I want to override when textchanged is fired on a dropdownlist.

I need to check that the text change actually came from user input (from the keyboard) opposed to the text changing from databinding.

Could anyone supply me with a code sample in c# or vb?

Thanks!
0
Comment
Question by:badpilot
  • 2
3 Comments
 
LVL 17

Expert Comment

by:nepaluz
ID: 35020066
why are you using a textchanged handler?
Use the selectedindexchanged or selectedvaluechanged events instead.
0
 

Author Comment

by:badpilot
ID: 35036854
Sorry I maybe should have explained it better.

I'm using teleriks radmulticombobox and I want the user to be able to type in the box to search. When they reach a certain number of chars the textchanged fires and calls the method to get the data from the db and then binds the combobox.

The problem is that when the box binds the text value is changed to displaymember which fires the bind process again, which changes the text which fires the db call again and so on.

So I want to stop the textchanged from firing when the reason the text has changed is because of it binding.

Phew, I hope that makes sense!
0
 
LVL 17

Accepted Solution

by:
nepaluz earned 500 total points
ID: 35036969
a very mechanical way to handle thiswould be to declare a global boolean and only fire off the db routine when it is set, in your case, only when there has been a value typed into the combobox, and NOT when it is selected.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now