是否可以通过页面方法访问服务器控件?

发布于 2024-12-17 12:27:56 字数 117 浏览 4 评论 0原文

我想使用 JQuery 和页面方法更新 Gridviews 数据源,但我不确定如何访问我在页面上创建的 Gridview 控件。我知道我无法访问它的实例,但我想访问 id,所以只需重新绑定它。

这可能吗?

I would like to update a Gridviews datasource using JQuery and page methods, but I'm not sure how to access the Gridview control I created on the page. I know I can't access the instance of it, but I want to access the id so just rebind it.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

睫毛溺水了 2024-12-24 12:27:56

您正在使用这个 Gridview 做一些具体的事情吗?如果没有,我还建议(正如 Niels 所建议的那样)使用 ajax 调用(使用 jQuery),而不是使用 Gridview 尝试使用 Table。 检查这个很好HTML Gridview 输出。它使用 jQuery、JSON、WebService。

祝你好运!

Is there something specific you are doing with this Gridview? If not, I would also suggest (as Niels suggests) to use an ajax call (use jQuery) and instead of a Gridview try a Table. Check this nice HTML Gridview out. It uses jQuery, JSON, WebService.

Good luck!

喜爱皱眉﹌ 2024-12-24 12:27:56

如果你想更新,你必须构建一个网络方法。有关更多信息,请参阅他的页面: http://encosia .com/using-jquery-to-directly-call-aspnet-ajax-page-methods/

如果您有一个 Webmethod,您可以通过调用以下内容来访问该函数:

$.ajax({
    url: "page.aspx/webmethodname",
    success : function(data){}
})

但是您必须通过以下方式构建 Gridview 代码。

或者使用 asp.net 中的默认 Ajax:http://www. ezineasp.net/post/ASP-Net-AJAX-GridView-Loading.aspx

If you want to update you have to build a webmethod. Seet his page for more information: http://encosia.com/using-jquery-to-directly-call-aspnet-ajax-page-methods/

If you got a Webmethod, you can access that function by calling something like:

$.ajax({
    url: "page.aspx/webmethodname",
    success : function(data){}
})

But then you have to build your Gridview through code.

Or use default Ajax from asp.net: http://www.ezineasp.net/post/ASP-Net-AJAX-GridView-Loading.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文