tags:

views:

17

answers:

2

In Winforms, why is there no databound event on combobox as there is in ASP.NET dropdown? Is there any way to mimic the event?

+1  A: 

Because there is a page-cycle in ASP.NET, there is a DataBound event for data-bound controls to notify the control's server-side code that any data binding logic written for the control has completed. The event is used to format data-bound content or to initiate data binding in other controls that depend on values from the current control's content.

Since Winforms doesn't have to deal with a similar page cycle, no DataBound event is necessary.

Robert Harvey
A: 

You can override the ToString method on the object that you bind to the combobox to change what is displayed. If you can't do that (for example, if you don't own the objects that you're binding, or you use ToString for something else), then you can create a new class that contains your data item and overrides ToString to change what's displayed.

Dean Harding