I have an <asp:DropDownList>
witch gets filled by static list items.
<asp:DropDownList ... OnDataBound="handlerMethod">
<asp:ListItem Value="..." Text="..." />
<asp:ListItem Value="..." Text="..." />
<asp:ListItem Value="..." Text="..." />
</asp:DropDownList>
The problem is that the OnDataBound
event does not get triggered when the list is filled. I need it to trigger to fill some other data from the list items that are in the dropdown.
The documentation says:
This method notifies a server control that any data binding logic associated with the control has completed.
My eyes are on this "logic" word which makes me thing that i missed the point on when the event is triggered
But if that is the case, how can I get the event triggered or what other event can I use to know when the list has finished beeing filled?
Normally this means that you have deleted the
AutoEventWireup="true"
or set it to false, and that's why it's not wiring up the event.It can also mean that there is something wrong in the javascript that does not allow anymore code to run. Open the inspector (Chrome, Safari or Firebug in Firefox - Do not rely on IE Developer tools) and see if you have any javascript errors that can cause the page to stop.
It can also mean that the
handlerMethod
is not correctly set up, best way is to delete the html partOnDataBound="handlerMethod"
and the code behind of this method, then go todesign view
, open the Properties window in the Events and double click theOnDataBound
, it will add the event correctly. Set up a break point there and run in debug withdebug="true"
in yourweb.config
file.