是否可以通过页面方法访问服务器控件?
我想使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在使用这个 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!
如果你想更新,你必须构建一个网络方法。有关更多信息,请参阅他的页面: http://encosia .com/using-jquery-to-directly-call-aspnet-ajax-page-methods/
如果您有一个 Webmethod,您可以通过调用以下内容来访问该函数:
但是您必须通过以下方式构建 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:
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