另一种方法使用页面方法内的用户控件asp.net [英] Alternate way to use page method inside user control asp.net
问题描述
有没有办法通过它我可以实现用户控件内页方法的功能。
Is there a way by which i can achieve functionality of page method inside a user control.
任何帮助是AP preciated,感谢:)
Any help is appreciated, Thanks :)
推荐答案
最简单的方法可能是把一个web服务,你想要的功能,然后使用<一个href="http://msdn.microsoft.com/en-us/library/system.web.script.services.scriptserviceattribute.aspx">scriptservice属性,以使该可用。
The easiest way is probably to put the functionality you want in a webservice then use the scriptservice attribute to make that available.
作品非常相似的网页的方法。
Works very similarly to a page method.
相当广泛的例子 href="http://msdn.microsoft.com/en-us/magazine/cc163499.aspx">。
Quite an extensive example here.
<asp:ScriptManager>
<Services>
<asp:ServiceReference Path="~/MyWs.asmx" />
</Services>
</asp:ScriptManager>
然后你可以打电话给你的webMethods在JS:MyNamespace.MyWs.MyMethod();
Then you can call your webmethods in JS: MyNamespace.MyWs.MyMethod();
这篇关于另一种方法使用页面方法内的用户控件asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!