日期:2014-05-17 浏览次数:20528 次
$(document).ready(function () {
    GetSj();
})
function GetSj(data) {
    $.getJSON("../ApplicationProcessing/ShowAllCommodity.aspx", data, function (data) {
        $.each(data, function (key, val) {
            var sTp = "<td><img alt='' src='../Picture/Commodity/" + val.CPath + "' style='width:60px;height:107px;' /></td>";
            var sName = "<td><span style='color:#10c3f0;'><strong>" + val.Bname + "</strong></span><br/>" + WenZi(val.Cname); +"</td>";
            var sSpecification = "<td>" + val.CSpecification + "</td>";
            var sInventory = "<td>" + kucun(val.CInventory) + "</td>";
            var dRetail = "<td>" + GSH(val.CRetail) + "</td>";
            var dPrice = "<td>" + GSH(val.CPrice) + "</td>";
            var dNo = "<td ><input id='Text1' type='text' style='width:60px;' value='0' />件</td>"
            var cz = "<td><a href='#'>订购</a> <a href='#'>收藏</a></td>";
            $("<tr style='height:125px;'>" + sTp + sName + sSpecification + dRetail + dPrice + sInventory + dNo + cz + "</tr>").appendTo("#ShowSj");
        });
    });
}
public partial class ApplicationProcessing_Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
             Response.ContentType = "text/plain";
             TBL_BrandManager brandManager = new TBL_BrandManager();
             Response.Write(brandManager.ShowBrand());
        }
    }
}
//实体类转换json数据
    public class JsonHeleper
    {
        public string ObhestToJson<T>(T instance)
        {
            string result = string.Empty;
            DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(T));
            MemoryStream ms = new MemoryStream();
            json.WriteObject(ms, instance);
            ms.Position = 0;
            StreamReader sr = new StreamReader(ms);
            result = sr.ReadToEnd();
            return result;
        }
    }
}