getClientAddresses - > repopulates dropdownlists #ShipFrom_ClientAddressID and #ShipTo_ClientAddressID
updateShipFromAddress - > updates some fields based on the selected value of #ShipFrom_ClientAddressID
updateShipToAddress - > updates some fields based on the selected value of #ShipTo_ClientAddressID
}
Problem:
when the ClientId selected value changes, the other 2 dropdowlists are repopulated but functions updateShipFromAddress and updateShipToAddress do not fire. So i get the 3 dropdownlists with selected values but the other fields that should have been updated
stay empty.
jpassos
Member
7 Points
30 Posts
jquery dropdownList events
May 05, 2010 01:03 AM|LINK
Hi,
i have set the dropdownlist change event like this:
$("#ShipFrom_ClientAddressID").bind("change", updateShipFromAddress);
but this only works when the user changes the dropdownlist selected item
When the dropdownlist is populated it doesn't fire. Is there any other event line i can wire up to accomplish this?
Thanks for your time.
jquery mvc - 2 Dropdown list
DeadBurger
Participant
1804 Points
275 Posts
Re: jquery dropdownList events
May 05, 2010 06:39 AM|LINK
Add a click handler there:
$("#ShipFrom_ClientAddressID").bind("change click", updateShipFromAddress);
Blog: http://deadburger.blogspot.com/
jpassos
Member
7 Points
30 Posts
Re: jquery dropdownList events
May 05, 2010 08:08 AM|LINK
change click didn't work.
More info:
the dropdownlist is populated from a json function.
I would like to fire the event after it's populated
Yan Jun - MS...
Participant
1105 Points
118 Posts
Re: jquery dropdownList events
May 06, 2010 07:14 AM|LINK
Hi,
Welcome to ASP.NET forums! I'm glad to see your active participation and discussion in ASP.NET forums. please modify your code and like this
$('#ShipFrom_ClientAddressID').bind({ click: function() { // some codes }, mouseover: function() { // some codes }, mouseout: function() { // // some codes } });Hope this will help you!
If you still have any doubt and concern about this issue, please let me know. If I misunderstood you, please kindly elaborate your question.
Please Mark as AnsweredIf this is helpful Or Un-Mark as Answered if it is not helpful.
Yan Jun
jpassos
Member
7 Points
30 Posts
Re: jquery dropdownList events
May 06, 2010 08:33 AM|LINK
Hi, thanks for taking the time to assist me in the question.
I tried your suggestion but didn't resolved mo problem.
I'll try to explain better:
the layout is like this:
$("#ClientId").bind("change", getClientAddresses);
$("#ShipFrom_ClientAddressID").bind("change", updateShipFromAddress);
$("#ShipTo_ClientAddressID").bind("change", updateShipToAddress);
getClientAddresses - > repopulates dropdownlists #ShipFrom_ClientAddressID and #ShipTo_ClientAddressID
updateShipFromAddress - > updates some fields based on the selected value of #ShipFrom_ClientAddressID
updateShipToAddress - > updates some fields based on the selected value of #ShipTo_ClientAddressID
Problem:
when the ClientId selected value changes, the other 2 dropdowlists are repopulated but functions updateShipFromAddress and updateShipToAddress do not fire. So i get the 3 dropdownlists with selected values but the other fields that should have been updated stay empty.
I think explained better this time
Thanks for the help.
jpassos
Member
7 Points
30 Posts
Re: jquery dropdownList events
May 06, 2010 10:15 PM|LINK
firing the event manually after populating the dropdownlist did the trick
$("#ShipFrom_ClientAddressID").change();
Thanks for the help