I need to inject a new behaviour for every dropDownList control of my web app (asp.net/C#).
Each time a new value is selected in the dropdown a web method (using Ajax/JSON) is invoked.
Since I have “normal” controls of type DropDownList and custom controls using DropDownList within them, I planned to create a class inheriting from DropDownList class with the new behaviour and then switch all the currrent DropDownList instances to this one.
In this way all my normal and custom drop downs would automatically get the new feature.
However the custom control has already an impementation for the “onselectedindexchanged” event, where some other functions are implemented.
Since I would use the same event for the new (parent) class, it would be overwritten in the custom control.
Of course I can write in the custom control the same code as in the parent, but is there a way to avoid duplicate code?
Thanks,
Luca
C#:
Java