我怎样才能调用[的WebMethod]这在用户控件定义? [英] How can i call [WebMethod] which is defined in user control?

查看:95
本文介绍了我怎样才能调用[的WebMethod]这在用户控件定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#在Asp.Net工作,我有一个用户控件 [的WebMethod] 定义。我不希望使用Web服务。

I am working in Asp.Net using C# and I have a [WebMethod] defined in a User Control. I don't want to use a web service.

我怎么能说与 [的WebMethod] 属性的方法?我想从一个jQuery(阿贾克斯)请求调用它。

How can I call a method with an [WebMethod] attribute? I want to call it from a jQuery (Ajax) request.

推荐答案

您无法调用ASCX用户控件中声明的页面的方法。该页面的方法将在你的aspx中声明或公开为一个适当的ASMX Web服务。

You cannot call a page method declared within an ASCX user control. The page method would have to be declared in your aspx or expose it as a proper asmx web service.

这篇关于我怎样才能调用[的WebMethod]这在用户控件定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆