I've got 2 CascadingDropdownList
, Application and Role. When Application changes Role is populated.
I do a partial rendering of a UpdatePanel
with User List when Application or Role changes.
The problem is that when Application changes the value of Role sent in the POST
to render UpdatePanel
is the old Role value before Role is populated whih the list of roles of the new emphasized textselected Application.
So, the solution I am trying is to do the partial rendering after Role is populated. I remove Application trigger from the UpdatePanel
and launch a postback by hand using populated
event in Role CascadeDropDownList
.
This way, when Application changes, Role is populated and (thanks to the event) UpdatePanel
is updated. When Role changes the basic trigger in UpdatePanel
makes the updated.
Code Behind:
ToolkitScriptManager.RegisterStartupScript(Me, Me.GetType,"wireEvents","Sys.Application.add_load(addPopulatedEvent);", True)
HTML:
<script>
function updatePanel() { __doPostBack('<%=UpdatePanel1.ClientID %>', null); }
function addPopulatedEvent(sender, args) {if (!args.get_isPartialLoad()) { $find('<%=cmbRoles_CascadingDropDown.ClientID %>').add_populated(updatePanel); } }
</script>
And another problem raises. I can see in firebug network how the partial rendering POST
launch at the same time, sometimes even before, that the populate roles POST
. And still see the old 'pre-populated' value of Role in the partial rendering POST
. In a few words: CascadingDropdownList populated event
does not rise after the CascadingDropdownList is populated. It is weird because the event verb is in past form and a populating event
also exist. So everything tells me that populated event
should rise after Role is filled with the new data. But not.
2 Questions:
It was a real bug. Fixed in v15.1.3 version. Here is the issue report.