<label id=”txt2″></label>
</div>
</form>
</body>
后台页面:
protected void Page_Load(object sender, EventArgs e)
{
JsonAjax();
}
private void JsonAjax() {
string action = Request[“Action”];
if (!string.IsNullOrEmpty(action) && action == “action”) //判断是否通过前台的点击事件进来的
{
string str = DataTableConvertJson.DataTableToJson(“json”, Data.BindData().Tables[0]);
Response.Write(str);
Response.End();
}
}
最后给大家展示一下生成的json格式:
Top of Form
{“json”:[{“id”:”16″,”name”:”zhaoliu”,”sex”:”man”},{“id”:”19″,”name”:”zhangsan”,”sex”:”women”}]}
Bottomof Form










