protected void Button1_Click(object sender, EventArgs e)
    {
        PivotDrillDownDataSource     ds    = ASPxPivotGrid1.CreateDrillDownDataSource(0, 0);
        PropertyDescriptorCollection props = ((ITypedList)ds).GetItemProperties(null);

        DataTable table = new DataTable("drilldown");

        for (int i = 0; i < props.Count; i++)
        {
            table.Columns.Add(props[i].Name, props[i].PropertyType);
        }
        object[] row = new object[props.Count];
        for (int i = 0; i < ds.RowCount; i++)
        {
            for (int j = 0; j < props.Count; j++)
            {
                row[j] = ds.GetValue(i, j);
            }
            table.Rows.Add(row);
        }
        using (StringWriter writer = new StringWriter()) {
            table.WriteXml(writer, XmlWriteMode.WriteSchema);
            Session["drilldown"] = writer.ToString();
        }
    }
コード例 #2
0
 protected void BindGridView(string columnIndex, string rowIndex)
 {
     ASPxGridView1.DataSource =
         ASPxPivotGrid1.CreateDrillDownDataSource(Int32.Parse(columnIndex),
                                                  Int32.Parse(rowIndex));
     ASPxGridView1.DataBind();
 }
コード例 #3
0
        //获取点击单元格的明细数据
        protected string getDetail()
        {
            int    rowIndex  = int.Parse(Request["rowIndex"]);
            int    colIndex  = int.Parse(Request["colIndex"]);
            int    pageSize  = int.Parse(Request["pageSize"]);
            int    pageIndex = int.Parse(Request["pageIndex"]);
            string sortField = Request["sortField"];
            string sortOrder = Request["SortOrder"];

            DataTable dt = ASPxPivotGrid1.DataSource as DataTable;
            PivotDrillDownDataSource source = ASPxPivotGrid1.CreateDrillDownDataSource(colIndex, rowIndex);

            List <int> list = new List <int>();

            for (int i = 0; i < source.RowCount; i++)
            {
                list.Add(source[i].ListSourceRowIndex);
            }

            var result = dt.Copy();

            for (int i = result.Rows.Count - 1; i >= 0; i--)
            {
                if (list.Contains(i) == false)
                {
                    result.Rows.RemoveAt(i);
                }
            }

            if (!string.IsNullOrEmpty(sortField))
            {
                if (sortOrder == "asc")
                {
                    result = result.AsEnumerable().OrderBy(c => c[sortField]).CopyToDataTable();
                }
                else
                {
                    result = result.AsEnumerable().OrderByDescending(c => c[sortField]).CopyToDataTable();
                }
            }

            int total = result.Rows.Count;

            for (int i = result.Rows.Count - 1; i >= 0; i--)
            {
                if (i < pageIndex * pageSize || i >= (pageIndex + 1) * pageSize)
                {
                    result.Rows.RemoveAt(i);
                }
            }

            IsoDateTimeConverter datetype = new IsoDateTimeConverter();

            datetype.DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";

            var objResult = new { total = total, data = result };

            return(JsonConvert.SerializeObject(objResult, datetype));
        }
 protected void OnASPxGridViewCustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
 {
     string[] param = e.Parameters.Split('|');
     if (param.Length != 3)
     {
         return;
     }
     ASPxGridView1.DataSource =
         ASPxPivotGrid1.CreateDrillDownDataSource(int.Parse(param[1]), int.Parse(param[2]));
     ASPxGridView1.DataBind();
     ASPxGridView1.PageIndex = 0;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        ASPxPivotGrid1.CellTemplate = new CellTemplate();
        string columnIndex = Page.Request["ColumnIndex"];
        string rowIndex    = Page.Request["RowIndex"];

        if (!(string.IsNullOrEmpty(columnIndex) || string.IsNullOrEmpty(rowIndex)))
        {
            ASPxGridView1.DataSource =
                ASPxPivotGrid1.CreateDrillDownDataSource(int.Parse(columnIndex), int.Parse(rowIndex));
            ASPxGridView1.DataBind();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         if (Request.Params["__EVENTTARGET"].Contains(ASPxPivotGrid1.ID) && Request.Params["__EVENTARGUMENT"].StartsWith("Data"))
         {
             string[] args = Request.Params["__EVENTARGUMENT"].Split('|');
             if (args.Length == 3)
             {
                 if (!ASPxPivotGrid1.IsDataBound)
                 {
                     ASPxPivotGrid1.DataBind();
                 }
                 Session["DS"] = Convert(ASPxPivotGrid1.CreateDrillDownDataSource(int.Parse(args[1]), int.Parse(args[2])));
                 Response.Redirect("DetailPage.aspx");
             }
         }
     }
 }