asp.net 数据-模型 jquery

来源:百度知道 编辑:UC知道 时间:2024/06/22 21:41:48
ASP.NET + MSSQL VS2005

从数据库出来到DataTable

再把DataTable转换成模型

public class student
{
public string name;
public int no;
}

之类的,便于处理

当用到jquery等框架用Ajax请求时,服务器到底要生成怎样的数据给客户端

XML?JSON? 并且怎么实现?(从任意的模型到XML或JSON或者其他)

VS2008能够很方便地从模型到JSON,VS2005就...

还有逆向,客户端发给服务器端...

我主要想问一下各位大侠

服务端和客户段数据到底要用怎样的表现形式比较合理?

从数据库出来到DataTable

再把DataTable转换成模型

public class student
{
public string name;
public int no;
}

之类的.......之后...

我们就要用...JSON.NET

扩展Json.net(Newtonsoft.Json) http://tech.it168.com/msoft/2007-11-25/200711251630239.shtml
在.NET中使用Newtonsoft.Json转换,读取,写入 http://hi.baidu.com/cnydpl/blog/item/f946c609befd04a92fddd418.html

asp.net ajax 已经有现成的从客户端调用服务端方法的功能, 你可以看看 http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx 这个文档,不是很复杂。

这样,不必使用jQuery的ajax()方法,微软的ajax框架会给你准备好所有的底层操作,最后你得到