Paul
There is an AjaxControlToolkit example at
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/CascadingDropDown/Cascadi
ngDropDown.aspx
Of course this is ASP.NET using the AjaxControlToolkit and is not the pure
ajax (jQuery) way of doing things, and yes you are going to have to write
some code to populate the lists from web services (or page web methods).
Apparently the .NET development team made an announcement March 2010 that
jQuery is the way to go for future development, which I think is good news.
Possibly navigating the sub arrays dynamically may be a better solution in
the long term (and more challenging) but there are simple (already working)
ways to do the same thing. So is it really worth the additional effort? We
have used this approach in a number of projects and have yet to experience
any response time issues (it's very quick indeed).
Regards
Maurice O'Prey
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Paul Holm
Sent: 16 December 2010 20:49
To: web400@xxxxxxxxxxxx
Subject: Re: [WEB400] Navigating JSON sub-arrays dynamically
Hi Mike,
Does ASP/.net provide a reusable component to handle this "parent/child"
drop down list challenge or do you have to code for each occurance?
This "parent/child" pattern is common in a lot of business apps we run
into. (IE Select a car mfg such as Ford or GM, then based on the
parent, show the models (F150, Explorer)
Thanks, Paul
Mike Wills wrote:
I figured it out finally! I found this:
http://inderpreetsingh.com/2010/10/14/javascriptjson-find-index-in-an-array-
of-objects/
<
http://inderpreetsingh.com/2010/10/14/javascriptjson-find-index-in-an-array
-of-objects/>The
problem with Kevin's solution is that the IDs will not be sequential or
they
can change.
From there these are the two lines that work:
var i = findIndexByKeyValue(jsonRequestType, "Id", key);
$.each(jsonRequestType[i].HourTypeCodes, function(i, item) {
--
Mike Wills
http://mikewills.me
As an Amazon Associate we earn from qualifying purchases.