2013-08-27 25 views
0

我有一個對象從我的查詢,現在我想將其轉換爲字符串,然後發送到我的JSON頁面,但我得到[object object], [object object]連載並取得對象物體

我的查詢是:

using System.Web.Script.Serialization; 

public partial class AjaxProcess : System.Web.UI.Page 
{ 
    protected void Page_Load(object sender, EventArgs e) 
    { 
     SouthParsModel.SouthParsEntities db = new SouthParsModel.SouthParsEntities(); 
     JavaScriptSerializer js = new JavaScriptSerializer(); 
     string serText = ""; 

     int id = Convert.ToInt32(Request["get_subcategory_or_product_of_this"]); 

     var CatList = from rows in db.Categories 
        where rows.parentid_FK == id 
        select new { rows.id, rows.name, Type = "category"}; 


Response.Write(serText); 
Response.End(); 
+0

我的問題是C#(asp.net編程),用於序列化! –

+0

我不明白你的問題,你從中得到了[[object object]],你期望得到什麼? – CodingGorilla

+0

您能否提供serText中的字符串和您的預期 –

回答

1

你使用JSON.parse(stringhere);當你將序列化的對象傳遞給你的頁面時?