jQuery的Ajax调用code后面的用户控制方法 [英] Jquery ajax call to code behind method in user control

查看:104
本文介绍了jQuery的Ajax调用code后面的用户控制方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

,我们可以调用用户控制code后面的方法使用jQuery AJAX?

Can we call User control code behind method using Jquery ajax ?

谢谢

推荐答案

您不能直接使用jQuery的Ajax用户控件调用的方法。

You can't call a method directly in a user control using Jquery Ajax.

您可以尝试以下方法之一寿:

You can try one of the following approaches tho:

  • 设置网址 PageName.aspx?方法= YourMethod 或者添加一些 其他限制,所以你知道哪些用户控件应该执行 方法。然后在你的用户控件,你可以检查是否存在等 在查询字符串的限制,并执行给定的方法。

  • Set the URL to PageName.aspx?Method=YourMethod or maybe add some other restrictions so you know which user control should execute the method. Then in your user control you can check for the existance of your restrictions in the querystring, and execute the given method.

您可以只使用客户端回调来执行一些方法,如果你 需要做的事情异步。在页面的GetCallbackResult,则 可以发现,导致回调的控制,并通过该请求 它的参数来控制。

You can just use client callback to execute some method, if you need to do something async. in the GetCallbackResult in the page, you can find the control that caused the callback, and pass the request with its arguments to the control.

这篇关于jQuery的Ajax调用code后面的用户控制方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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