protected void PopulateControls()
    {
        string    today    = Session["TodayDate"].ToString();
        int       userId   = Int32.Parse(Session["UserID"].ToString());
        int       countMax = 0;
        DataTable dt       = ItemAccess.GetItemNumTopList(today, userId, out countMax);

        string max      = "1";
        string step     = "1";
        string itemName = "";
        string countNum = "";

        if (dt.Rows.Count > 0)
        {
            max  = countMax.ToString();
            step = Math.Floor(Double.Parse(max) / 10).ToString();

            int i = 0;
            foreach (DataRow dr in dt.Rows)
            {
                if (i == 15)
                {
                    break;
                }
                string dot = (i < 15 - 1 && i < dt.Rows.Count - 1 ? "," : "");
                itemName += "{\"text\":\"" + dr["ItemName"].ToString() + "\",\"rotate\":90}" + dot;
                countNum += dr["CountNum"].ToString() + dot;
                i++;
            }
        }

        Response.Write(GetChartJsonString(itemName, countNum, max, step));
        Response.End();
    }
示例#2
0
    protected void PopulateControls()
    {
        int       countMax = 0;
        DataTable dt       = ItemAccess.GetItemNumTopList(today, userId, out countMax);

        NumTop.DataSource = dt;
        NumTop.DataBind();

        this.hidChartData.Value = ItemHelper.GetChartData(dt, "PageUrl");
    }