• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

来自 UserControl 的 ASP.NET AJAX 页面方法

用户头像
it1352
帮助5

问题说明

我想将 ASP.NET AJAX 页面方法功能与用户控件一起使用.有没有办法能够在 UserControl 的代码后面而不是 Page 的代码后面指定我的静态 [WebMethod]?

I would like to utilize the ASP.NET AJAX Page Methods functionality with a user control. Is there a way to be able to specify my static [WebMethod] inside the UserControl's code behind instead of the Page's code behind?

正确答案

#1

你可能做不到.用户控件不具备页面的所有功能,不能直接调用.相反,您应该创建一个 Web 服务 (asmx) 来处理这种情况.如果您愿意,可以将 Web 服务调用路由到您的用户控件内的静态方法.

You probably can't. The user control doesn't have all the functionality of a page and can't be called directly. You should instead create a webservice (asmx) to handle this scenario. If you wanted, the webservice call could be routed to the static method inside your user control.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tangcbjgg
系列文章
更多 icon
同类精品
更多 icon
继续加载