Showing posts with label heres. Show all posts
Showing posts with label heres. Show all posts

Wednesday, March 21, 2012

CascadingDropDown Scenario!

Ok heres the deal, go the CascadingDropDown works on a simple aspx page but when I incorporate it into my MasterPages it fails with 12031 error code

Does the page has to derive from Page base class?

TIA

Hi,

Please make sure that the web method used by the cascadingDropDown can't be defined in masterpage, in this case, it can't be accessed from client side directly. Be sure to use a web service.

CascadingDropDown needs to fire "SelectedIndexChanged" from client-side

It seems I always end up with more questions than answers...

So...here's the scenario this time.

I've got two dropdownlists, Make (ddlMake) and Model (ddlModel) with a CascadingDropDownExtender attached to ddlModel. Obviously, when the user changes the Make, I need to retrieve the appropriate Models based on the selection. No problem, that part works just fine.

The twist is this: When I load this up into a ModalPopup, a record is going to (pardon the pun) drive what's being populated into ddlMake. I'm using Javascript to .show() my ModalPopup after I've looked up the record, so the code goes a little like this:

function showModal(object)
{
var _ddlMake = document.getElementById("<%= ddlMake.ClientID %>");
var _ddlModel = document.getElementById("<%= ddlModel.ClientID %>");

// Dummy for now, will be pulled from the loaded record
_ddlMake.options[4].selected = true;
_ddlMake._onParentChange(null,null);

var _popup = $find(object);
_popup.show();
}


Some of the posts I've seen suggested the _onParentChange(null,null), but Firebug is barking saying "_ddlMake._onParentChange is not a function". Granted, it's one of the internals of the CascadingDropDown, but others have stated that this is the way to do it.

What I'm wondering is how to do this. I can't believe that I'm the only person to have ever thought of needing to set/fire these events from the client-side. I'd love some help on this one, that's for sure!

Thanks in advance,

Ric

Bump...still needing some help...

CascadingDropDown Method Error 500 ?

Hello!
I looked through lots of solutions to this problem on this forum but nothing helps - I still get Method Error 500 in drop down list.
Here's the code I use:

LocationService.asmx
----------

[WebService(Namespace =http://www.lgcon.ca/)]
[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]
publicclassServiceLocation : System.Web.Services.WebService
{

[WebMethod]
[System.Web.Script.Services.ScriptMethod]
publicCascadingDropDownNameValue[] GetCountry(string knownCategoryValues,string category)
{
List<CascadingDropDownNameValue> values =newList<CascadingDropDownNameValue>();

values.Add(newCascadingDropDownNameValue("one","one"));
values.Add(newCascadingDropDownNameValue("two","two",true));

return values.ToArray();
}

}

ASPX page:
------
<asp:DropDownListID="ddlCountry"runat="server"/>
<cc1:CascadingDropDownID="cddCountry"runat="server"TargetControlID="ddlCountry"Category="Country"PromptText="Select a country"ServicePath="~/modules/location/ServiceLocation.asmx"ServiceMethod="GetCountry"/>

What am I doing wrong?

Thanks for help!

ok nevermind .. got it working .. just had to add "[System.Web.Script.Services.ScriptService]" before class declaration :)