Monday, March 26, 2012

cascadingdropdowns when only one listitem

I am happily using cascading dropdowns for a three-level stack. In some cases, there is only one item in the generated list apart from the select prompt. Common sense and good design suggests that the one item should be auto-selected but this has not been implemented in the Toolkit.

I tried to implement it by setting the selected attribute (third parameter) to 'true' in the Web service. This worked for the displayed ddl, but the underlying value was not set . Hence the next level in the dropdown failed because no value was supplied.

Is this a bug or am I doing something wrong?

The relevant line in the VB Web Service (PageMethod) is:

values.Add(

New CascadingDropDownNameValue(sCompany, sCompanyId,True))

If I do not use the third parameter, I get the standard result with my Prompt showing in the ddl, and everything working when I actually select the one item.

This sounds like a bug. Could you whip up a quick sample page demonstrating the problem and file the issue at CodePlex?

http://www.codeplex.com/WorkItem/List.aspx?ProjectName=AtlasControlToolkit

Thanks!

No comments:

Post a Comment