通过WCF和JQuery绑定网格

问题描述:

我如何使用WCF

1)您需要设计一个WCF服务来查询您的SQL数据库

我不知道您对WCF有多少了解,所以这里有一篇简单的我的第一个WCF服务"类型的文章

http://www.myitblog.com/sundararajan/programming-your-first-wcf- service.html [ ^ ]

2)您需要从jQuery代码中调用WCF服务.在west-wind.com上非常不错的文章+代理源代码

http://www.west-wind.com/weblog/posts/324917.aspx [ ^ ]

3)您需要将ajax调用的结果绑定到gridview

这是在客户端而不是服务器上发生的,因此它不像服务器端数据绑定,我们只想更新显示的HTML.您可以构建自己的HTML并替换类似的内容....

jQuery(''#MyElement'').html(someBuiltHtmlString);

或者您可以在这里阅读

http://haacked.com/archive/2009/04/14/using-jquery-grid-with-asp.net-mvc.aspx [
1) You need to design a WCF service that will query your SQL database

I have no idea how much you know about WCF, so here is a simple ''my first WCF service'' type article

http://www.myitblog.com/sundararajan/programming-your-first-wcf-service.html[^]

2) You need to call the WCF service from your jQuery code. Quite a nice article + proxy source code on west-wind.com

http://www.west-wind.com/weblog/posts/324917.aspx[^]

3) You need to bind the results of your ajax call to the gridview

This happens on the client rather than the server, so it''s not like a server side databind, we just want to update the HTML displayed. You can build up your own HTML and replace something like....

jQuery(''#MyElement'').html(someBuiltHtmlString);

Or you could have a read here

http://haacked.com/archive/2009/04/14/using-jquery-grid-with-asp.net-mvc.aspx[^]