Geeks With Blogs

News
Steve Clements .Net and then some....

In my last post I went over a couple of problems I am found while migrating to the new AJAX beta framework.  Mainly this was related to Web Services with a little on the Cascading drop down control...I have since got some more info in about this control so instead of updating that post I thought that the Cascading drop down deserved one all of its own!!! :)

I am only going to cover the problems I found when migrating; this is not a tutorial on using the control.  There are plenty of those around!

1.  The cascading drop down controls (there now needs to be a separate control for each drop down) needs to be in the same update panel as the drop down list controls that they extend.

2.  The web service class either needs

[Microsoft.Web.Script.Services.ScriptService]

or

using Microsoft.Web.Script.Services;

 

namespace Clm.Web.Services

{

    [ScriptService]

    public class Foo

3.  Your page methods need to be static

4.  Your page methods need to be declared in the aspx markup file (not code behind), Matt Gibbs has confirmed this as a bug and they will have a fix for it soon.  Check Rick Strahl's post here.

 

I think that's just about it !!!

Posted on Monday, October 23, 2006 9:25 PM ASP.net AJAX | Back to top


Comments on this post: Atlas to ASP.net AJAX: Cascading Drop Down

# re: Atlas to ASP.net AJAX: Cascading Drop Down
Requesting Gravatar...
Hi thanks for u'r post. after reading your post I was able to get cascadingdropdown working with new asp.net ajax.
My problem is i want to implement it in a sharepoint website. not in a webpart.
whenever i use cascading dropdown in the sharepoint website it breaks at CascadingDropDownBehavior.js in _setOptions method.

throws an error saying
if (list) {
for (i = 0 ; i < list.length ; i++) {
var listItemName = list[i].name;

list[i].name is undefined.

have u ever encoitered a problem like this? help is much appriciated.
thanks

Left by Saj on Nov 03, 2006 12:27 AM

# re: Atlas to ASP.net AJAX: Cascading Drop Down
Requesting Gravatar...
[WebMethod]
public CascadingDropDownNameValue[] GetPlantTypes(string
knownCategoryValues, string category)
{
DataTable dtPlantTable = Common.GetPlantTypes(0, out err);
List<CascadingDropDownNameValuevalues = new
List<CascadingDropDownNameValue>();
foreach (DataRow dr in dtPlantTable.Rows)
{
string sPlantTypeDescription =
(string)dr["PlantTypeDescription"];
int iPlantTypeID = (int)dr["PlantTypeID"];
values.Add(new
CascadingDropDownNameValue(sPlantTypeDescription,
iPlantTypeID.ToString()));
}
return values.ToArray();
}

[WebMethod]
public CascadingDropDownNameValue[] GetPlantVarieties(string
knownCategoryValues, string category)
{
StringDictionary kv =
CascadingDropDown.ParseKnownCategoryValuesString(k nownCategoryValues);

// string sPlantTypeID = "2";
// int iPlantTypeID = LT.Utils.CInt(sPlantTypeID);

int iPlantTypeID;
if (!kv.ContainsKey("PlantTypeDescription") || !
Int32.TryParse(kv["PlantTypeDescription"], out iPlantTypeID))
{
return null;
}

DataTable dtVarietyTable = Common.GetVarieties(0,
iPlantTypeID, out err);

List<CascadingDropDownNameValuevalues = new
List<CascadingDropDownNameValue>();
foreach (DataRow dr in dtVarietyTable.Rows)
{
string sVarietyDescription =
(string)dr["varietyDescription"];
int iVarietyID = (int)dr["varietyID"];
values.Add(new
CascadingDropDownNameValue(sVarietyDescription,
iVarietyID.ToString()));
}

return values.ToArray();
}

#endregion methods
}
}
Reply Me If u r sucessed using this webMethod
Left by Debashis on Feb 26, 2008 12:46 PM

# re: Atlas to ASP.net AJAX: Cascading Drop Down
Requesting Gravatar...
You will be best placed to post your question on the asp.net forums, in the AJAX toolkit section.
Left by Steve Clements on Feb 26, 2008 12:49 PM

Your comment:
 (will show your gravatar)


Copyright © Steve Clements | Powered by: GeeksWithBlogs.net