Question

I'm creating a DotNetNuke 4.x module, and need an AJAX CascadingDropDown in my module. I have it defined as follows...

<asp:UpdatePanel runat="server" ID="CascadingDropDowns">
    <ContentTemplate>
        <asp:DropDownList runat="server" ID="SelectGroupDropDownList">
        </asp:DropDownList>
        <ajax:CascadingDropDown runat="server" ID="SelectGroupDropDownListExtender" Category="Group" 
            TargetControlID="SelectGroupDropDownList" PromptText="Select a Group" ServiceMethod="GetGroups">
        </ajax:CascadingDropDown>
        <!-- more dropdowns & cascadingdropdown extenders here -->

With the page method defined in the codebehind of the ascx like this...

[WebService]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService()]
public partial class EligibilityView : PortalModuleBase
{
    [WebMethod]
    [ScriptMethod]
    public CascadingDropDownNameValue[] GetGroups(string knownCategoryValues, string category)
    {
        var results = new List<CascadingDropDownNameValue>();

        // code here to fill the list with values...

        return results.ToArray();

    }

When I run the page, I get a "[Method error 500]" - and can't figure out what the heck I'm doing wrong. I think that the problem is that the page can't find the webmethod because its defined inside the ASCX control and not the page itself. I do need to keep it defined this way - and not create an ASMX service - since this is going to be compiled into a module for DotNetNuke and I want to keep things simple inside the module.

Any suggestions would be greatly appreciated.

Was it helpful?

Solution

I don't think there's going to be an easy way to get access to that web service method while it's in the ASCX. "Simple," in this case, probably means adding an ASMX to the module.

Is there a reason you're thinking that adding an ASMX will be a problem?

Adding another file to the module package should involve the same process that you would use to add the control itself. In the manifest you'll just need to specify it in the files section, and then make sure it ends up in the package. You can also use a resource zip file in the package and just specify that zip, making sure that your .ascx and .asmx files (and any other content files) are in there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top