获取Json数据

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JsonSendWay.aspx.cs" Inherits="JsonSendWay" %>

<% =GetJsonData()%>

//代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json;

public partial class JsonSendWay : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {



  }
  protected string GetJsonData()
  {
    string jsonData = "";
    string sendWayId = Request.QueryString["sendWayId"];
    if (!string.IsNullOrEmpty(sendWayId))
    {
      SendWay sendWay = OrderInfoManager.GetSendWayById(Int32.Parse(sendWayId));
      if (sendWay != null)
      {
        jsonData = JsonConvert.SerializeObject(sendWay);
      }
    }
    return jsonData;
  }
}

 

 

  

 

posted @ 2014-08-03 23:34  wolf child  阅读(301)  评论(0编辑  收藏  举报