views:

2017

answers:

1

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.

+4  A: 

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.

bdukes
I was trying to keep the page methods in the ascx just to make deployment simple. I'm fairly new to nuke - last time I looked at it was probably version 1 - so wasn't sure if adding an asmx file to the mix would make packaging and deployment more difficult.
Scott Ivey
I can vouch for packaging and deploying an asmx file being really no different than any other resource (.ascx, .gif, .js, .doc, etc...)
Ian Robinson