DotNetNuke 模块中的 CascadingDropDown => [方法错误500]
我正在创建一个 DotNetNuke 4.x 模块,并且需要在我的模块中使用 AJAX CascadingDropDown。 我将其定义如下...
<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 -->
在 ascx 的代码隐藏中定义了页面方法,如下所示...
[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();
}
当我运行页面时,我收到“[方法错误 500]” - 并且无法弄清楚是什么哎呀我做错了。 我认为问题在于页面找不到 webmethod,因为它是在 ASCX 控件内部定义的,而不是页面本身。 我确实需要以这种方式定义它 - 而不是创建 ASMX 服务 - 因为这将被编译到 DotNetNuke 的模块中,并且我希望模块内部的事情保持简单。
任何建议将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为在 ASCX 中不会有一种简单的方法来访问该 Web 服务方法。 在这种情况下,“简单”可能意味着向模块添加 ASMX。
您是否有理由认为添加 ASMX 会成为问题?
将另一个文件添加到模块包应该涉及与添加控件本身相同的过程。 在清单中,您只需在文件部分中指定它,然后确保它最终出现在包中。 您还可以使用包中的资源 zip 文件,只需指定该 zip,确保您的 .ascx 和 .asmx 文件(以及任何其他内容文件)位于其中。
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.