Ignacio Machin wrote:
How can I call an event from another event:
I want to call :
DropDownList_Se lectedIndexChan ged
in:
Page_Load
I'd expect the dropdownlist to actually fire that event itself if the
SelectedIndex property changed.
If, on the other hand, you want to execute the same code as changing the
SelectedIndex property does, the correct way (in my opinion) would be to
take the code out of that event handler and place it in a separate
method, ie. "UpdateRelatedD ata" or something, and then call that method
from both DropDownList_Se lectedIndexChan ged and Page_Load.
If you really don't want to do that, the "correct" way to execute the
same code would be to:
1. Call the OnSelectedIndex Changed method on the dropdownlist, if that
method is public (mostly isn't, so go to 2.)
2. Call the method you attached to the event directly, ie. call
DropDownList_Se lectedIndexChan ged, and provide any necessary parameter
values to it.
--
Lasse Vågsæther Karlsen
mailto:la***@vk arlsen.no