且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-12-01 15:35:10

你可能做不到.用户控件不具备页面的所有功能,不能直接调用.相反,您应该创建一个 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.