I've recently migrated one of my business apps from the Atlas CTP to AJAX 1.0. After making all of the changes necessary to get the site to correctly compile and run I thought I was done, but instead have run into an unexpected problem with the CascadingDropDown control. So far, with regards to the CDD controls I have done the following:
- Changed the CDD tags to be individual control entities instead of children to a single parent.
old:
<atlasToolkit:CascadingDropDown ID="cddActivity" runat="server" SuppressValidationScript="true">
<atlasToolkit:CascadingDropDownProperties TargetControlID="PERFORMANCE_UNIT" ParentControlID="BUSINESS_UNIT" PromptText=" " ServiceMethod="GetPerformanceUnitsForBU" LoadingText="<%$ Resources:Resource, CCDDLoadingText %>" ServicePath="~/services/RefTables.asmx" Category="PERFORMANCE_UNIT" />
new:
<cc1:CascadingDropDown ID="cddActivity3" runat="server" TargetControlID="PERFORMANCE_UNIT" ParentControlID="BUSINESS_UNIT" PromptText=" " ServiceMethod="GetPerformanceUnitsForBU" LoadingText="<%$ Resources:Resource, CCDDLoadingText %>" ServicePath="~/services/RefTables.asmx" Category="PERFORMANCE_UNIT" />
- I have added the "[System.Web.Script.Services.ScriptService()]" tag to the ASMX file referenced in the ServicePath.
- I have added the "<jsonSerialization maxJsonLength="20" />" tag to the web.config file as suggested in other posts.
If it helps the function referenced in the ASMX file looks like this:
[WebMethod]
public CascadingDropDownNameValue[] GetPerformanceUnitsForBU( string knownCategoryValues, string category)
{ StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString( knownCategoryValues);
if (!kv.ContainsKey("BU")) return null;
string parentKey = kv["BU"];
return GatherList(parentKey, new REF_PERFORMANCE_UNITTableAdapter()).ToArray();
}
private List<CascadingDropDownNameValue> GatherList(string parentKey, object ta)
{ string[] param = new string[1];
param[0] = "%" + parentKey + "%";
Type type = ta.GetType();
System.Reflection.MethodInfo method = type.GetMethod("GetDataByParent");
DataTable dt = (DataTable)method.Invoke(ta, param);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
for(int i = 0; i < dt.Rows.Count; i++) { values.Add(new CascadingDropDownNameValue((string)dt.Rows[i]["DESCRIPTION"], dt.Rows[i]["KEY"].ToString()));}
return values;
}
Now, I know this works because it did so with the Atlas CTP, but now it doesn't. So... Can anyone spot the boneheaded mistake I made? I know I must have missed something, but for the life of me I can't see it.
Thanks,
Sean