I Have a Gridview . I wanted to display data from Webservice via Ajax calls in ASP.net Please ,let me know the solution for this. Thanks in Advance.
我有一个Gridview。我想在ASP.net中通过Ajax调用显示来自Webservice的数据请告诉我这个解决方案。提前致谢。
2 个解决方案
#1
I'm not too sure if I understood you correctly but there is no way to bind a Grid View with an AJAX call (yet). This is simply because you are dealing with the client side and a Grid View is just a HTML table. You will have to write your on custom method to handle your AJAX response and build a table on the fly....I've done this before and it works quite well...
我不太确定我是否理解正确但是没有办法将网格视图与AJAX调用绑定(尚未)。这只是因为您正在处理客户端而Grid View只是一个HTML表。您将不得不编写自定义方法来处理您的AJAX响应并动态构建表格....我之前已经完成了这个并且它运行良好...
If you really want to go down this path I recommend you seeing this jQuery plugin that enables table sorting and paging...it's pretty cool ...
如果你真的想沿着这条路走下去,我建议你看看这个jQuery插件,它可以实现表格排序和分页...这很酷......
#2
Can't you just create a method to call the web service and return your data object/dataset and then bind that to your grid and wrap the grid in an update panel, on the method end call myUDP.Update() to refresh the grid with the newly bound data.
您不能只创建一个方法来调用Web服务并返回您的数据对象/数据集,然后将其绑定到您的网格并将网格包装在更新面板中,方法结束调用myUDP.Update()以刷新网格使用新绑定的数据。
#1
I'm not too sure if I understood you correctly but there is no way to bind a Grid View with an AJAX call (yet). This is simply because you are dealing with the client side and a Grid View is just a HTML table. You will have to write your on custom method to handle your AJAX response and build a table on the fly....I've done this before and it works quite well...
我不太确定我是否理解正确但是没有办法将网格视图与AJAX调用绑定(尚未)。这只是因为您正在处理客户端而Grid View只是一个HTML表。您将不得不编写自定义方法来处理您的AJAX响应并动态构建表格....我之前已经完成了这个并且它运行良好...
If you really want to go down this path I recommend you seeing this jQuery plugin that enables table sorting and paging...it's pretty cool ...
如果你真的想沿着这条路走下去,我建议你看看这个jQuery插件,它可以实现表格排序和分页...这很酷......
#2
Can't you just create a method to call the web service and return your data object/dataset and then bind that to your grid and wrap the grid in an update panel, on the method end call myUDP.Update() to refresh the grid with the newly bound data.
您不能只创建一个方法来调用Web服务并返回您的数据对象/数据集,然后将其绑定到您的网格并将网格包装在更新面板中,方法结束调用myUDP.Update()以刷新网格使用新绑定的数据。