Devexpress ASPxPivotGrid 按某列排序,以及把GrandTotal修改掉
<div>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr><td align="center" style="color:#039" mce_style="color:#039" colspan=3><h3></h3></td></tr>
                      <tr><td width="40%"></td><td width="27%" align="center"style="color:#039"><h5>在册罪犯总数:<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></h5></td><td width="33%"></td></tr>
<tr>
                        <td colspan=3>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ssodsn %>" SelectCommand="SELECT a.*,b.dept_name as sname,c.dept_name as dname FROM [dbo].[B_prinson] a inner join (select max(addtime) as addtime,deptid from B_prinson a group by deptid)m on a.addtime =m.addtime inner join B_department b on a.deptid=b.id inner join B_department c on a.deptidb=c.id order by a.autoid desc"></asp:SqlDataSource>
<dxwpg:ASPxPivotGrid ID="ASPxPivotGrid1"  SortBySummaryInfo-SummaryType="Max"  runat="server" CssClass="" DataSourceID="SqlDataSource1"    OnCustomFieldSort="ASPxPivotGrid1_CustomFieldSort" Font-Bold="True" Font-Size="Medium" Width="100%" OnCustomSummary="ASPxPivotGrid1_CustomSummary">
        <Styles CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass">
            <HeaderStyle BackColor="White">
                <HoverStyle>
                    <BackgroundImage ImageUrl="~/App_Themes/Glass/PivotGrid/pgHeaderBackHot.gif" Repeat="RepeatX" />
                </HoverStyle>
                <BackgroundImage ImageUrl="~/App_Themes/Glass/PivotGrid/pgHeaderBack.gif" Repeat="RepeatX" />
            </HeaderStyle>
            <FilterAreaStyle>
                <BackgroundImage ImageUrl="~/App_Themes/Glass/PivotGrid/pgFilterAreaBack.gif" Repeat="RepeatX" />
            </FilterAreaStyle>
            <FilterButtonPanelStyle>
                <BackgroundImage ImageUrl="~/App_Themes/Glass/PivotGrid/pgFilterPanelBack.gif" Repeat="RepeatX" />
            </FilterButtonPanelStyle>
            <TotalCellStyle Font-Bold="True" ForeColor="Red">
            </TotalCellStyle>
            <GrandTotalCellStyle Font-Bold="True" Font-Size="14px" ForeColor="#003399">
            </GrandTotalCellStyle>
</Styles>
        <Fields>
            <dxwpg:PivotGridField ID="field1" Area="RowArea" AreaIndex="0" Name="field1"  FieldName="dname" GroupIndex="0" InnerGroupIndex="0" SortMode="Custom"  >
                <ValueStyle  ForeColor="#003399" Font-Bold="True" Font-Size="13px">
                </ValueStyle>
</dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field2" Area="RowArea" AreaIndex="1" Name="field2" FieldName="sname" GroupIndex="0" InnerGroupIndex="1" SortMode="Custom">
                <ValueStyle   ForeColor="#003399" Font-Bold="True"  Font-Size="13px" >
                </ValueStyle>
</dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field3" Area="DataArea" AreaIndex="0"  Name="field3" FieldName="pnum1" Caption="在册数">
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
                <ValueStyle  ForeColor="#003399"  Font-Bold="True" Font-Size="Medium" CssClass="tdwd">
                </ValueStyle>
</dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field4" Area="DataArea" AreaIndex="1" Caption="在押数" Name="field4" FieldName="pnum2">
                <ValueStyle  ForeColor="#003399"  Font-Bold="True" Font-Size="Medium" CssClass="tdwd">
                </ValueStyle> <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field5" Area="DataArea" AreaIndex="2" Caption="出工" Name="field5" FieldName="pnum3" >
                <ValueStyle   ForeColor="#003399"  Font-Bold="True" Font-Size="Medium" CssClass="tdwd">
                </ValueStyle> <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field6" Area="DataArea" AreaIndex="3" Caption="留监" Name="field6" FieldName="pnum4">
                <ValueStyle  ForeColor="#003399"  Font-Bold="True" Font-Size="Medium" CssClass="tdwd">
                </ValueStyle> <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field7" Area="DataArea" AreaIndex="4" Caption="禁闭" Name="field7" FieldName="pnum5" >
                <ValueStyle  ForeColor="#003399"  Font-Bold="True" Font-Size="Medium" CssClass="tdwd">
                </ValueStyle> <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field8" Area="DataArea" AreaIndex="5" Caption="严管" Name="field8" FieldName="pnum6">
                <ValueStyle  ForeColor="#003399"  Font-Bold="True" Font-Size="Medium" CssClass="tdwd"> 
                </ValueStyle> <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field9" Area="DataArea" AreaIndex="6" Caption="留医" Name="field9" FieldName="pnum7">
                <ValueStyle  ForeColor="#003399" Font-Bold="True" Font-Size="Medium" CssClass="tdwd">
                </ValueStyle> <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field10" Area="DataArea" AreaIndex="7" Caption="其他" Name="field10" FieldName="pnum8">
                <ValueStyle  ForeColor="#003399"  Font-Bold="True" Font-Size="Medium" CssClass="tdwd">
                </ValueStyle><CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field" Area="ColumnArea" AreaIndex="0" Name="field" >
                <ValueTemplate>
<%-- <asp:Label ID="Label1" Width="600px" runat="server" Text="福州监狱当日罪犯分布情况" Font-Bold="true"  ForeColor="red" Font-Size="15pt"></asp:Label>
                   --%>
                </ValueTemplate>
                <CellStyle Font-Bold="True"  ForeColor="Red">
                </CellStyle>
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field11" Area="RowArea" AreaIndex="2" FieldName="deptid"
                Name="field11" Visible="False">
            </dxwpg:PivotGridField>
            <dxwpg:PivotGridField ID="field12" Area="RowArea" AreaIndex="3" FieldName="deptidb"
                Name="field12" Visible="False">
            </dxwpg:PivotGridField>
</Fields>
        <EmptyAreaTemplate>0</EmptyAreaTemplate>
        <Images ImageFolder="~/App_Themes/Glass/{0}/">
        </Images>
        <OptionsView ShowContextMenusForAllFieldValues="False" ShowColumnGrandTotals="False" ShowColumnHeaders="False" ShowDataHeaders="False" ShowFilterHeaders="False" ShowRowTotals="False" ShowRowHeaders="False" ShowColumnTotals="False" ShowRowGrandTotals="False" />
        <StylesPrint TotalCell-BackColor="Red" />
        <Groups>
            <dxwpg:PivotGridWebGroup />
        </Groups>
        <OptionsPager RowsPerPage="50">
        </OptionsPager>
    </dxwpg:ASPxPivotGrid>     
                                </td>
                      </tr>
                    </table>
    </div>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DevExpress.XtraPivotGrid.Localization;
using System.Collections.Generic;
using DevExpress.Web.ASPxPivotGrid;
using DevExpress.XtraPivotGrid;
public partial class allperson : System.Web.UI.Page
{
    ArrayList order = new ArrayList(new object[] { "一大队", "二大队", "三大队", "四大队", "五大队", "六大队", "七大队", "出入监大队", "" });
    ArrayList order1 = new ArrayList(new object[] { "一大队一中队", "一大队二中队", "一大队三中队", "二大队一中队", "二大队二中队", "二大队三中队", "三大队一中队", "三大队二中队", "三大队三中队", "四大队一中队", "四大队二中队", "四大队三中队", "五大队一中队", "五大队二中队", "五大队三中队", "六大队一中队", "六大队二中队", "六大队三中队", "七大队总仓", "七大队后勤队", "入监队", "集训队", "回归中心", "医院" });
    static allperson()
    {
        MyPivotGridLocalizer.Active = new MyPivotGridLocalizer();
}
protected void Page_Load(object sender, EventArgs e)
    {
}
protected void ASPxPivotGrid1_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e)
    {
if (e.Field.FieldName == "dname")
        {
            if (Equals(e.Value1, e.Value2))
            {
e.Result = 0;
            }
            else
            {
                e.Result = (order.IndexOf(e.Value1) > order.IndexOf(e.Value2)) ? 1 : -1;
            }
        }
        else if (e.Field.FieldName == "sname")
        {
if (Equals(e.Value1, e.Value2))
            {
e.Result = 0;
            }
            else
            {
                e.Result = (order1.IndexOf(e.Value1) > order1.IndexOf(e.Value2)) ? 1 : -1;
            }
        }
        else
            return;
e.Handled = true;
}
protected void ASPxPivotGrid1_CustomSummary(object sender, PivotGridCustomSummaryEventArgs e)
    {
        if (e.FieldName == "pnum1")
        {
this.Label1.Text=e.SummaryValue.CustomValue.ToString();
}
}
}
public class MyPivotGridLocalizer : PivotGridLocalizer
{
    public override string GetLocalizedString(DevExpress.XtraPivotGrid.Localization.PivotGridStringId id)
    {
        switch (id)
        {
            case PivotGridStringId.GrandTotal:
return "<div style="font-weight:bold; color:#003399;  font-size:16px" mce_style="font-weight:bold; color:#003399;  font-size:16px">合              计  </div>";
        }
        return base.GetLocalizedString(id);
    }
}
Devexpress ASPxPivotGrid 按某列排序,以及把GrandTotal修改掉的更多相关文章
- 10个devexpress  ASPxPivotGrid常见问题
		
原文:10个devexpress ASPxPivotGrid常见问题 1.DXperience ASPxGridView如何开启lightweight模式 描述:ASPxGridView样式主题中pa ...
 - Jtable 表格按多列排序(支持中文汉字排序)
		
这两天公司让做一个Jtable表格的排序,首先按A列排序,在A列相等时按B列排序,B列相等时按C列排序,ABC三列可以任意指定,最多分三列,这样的一个需求.由于我是大神,所以必须做了出来.ok,不自恋 ...
 - easyUI datagraid的列排序
		
在给datagraid做多列排序时请注意: 首先,做的是后台排序,那么需要设置: remoteSort:'true', 然后,不要添加 multiSort:'true',这个是多列一起排序无法实现.. ...
 - EF架构~真正被封装的排序方法,支持多列排序
		
回到目录 对于linq to sql 和linq to entity来说,当你把获取数据的方法封装了之后,总觉得还缺点什么,想了之后,应该是排序,但看了微软的orchard项目之后,觉得它的排序封装的 ...
 - 自定义多列排序:C++/Java实现
		
前言: 有些时候,我们在编程中会遇到多列排序的需求.假如在execle,这事儿就太easy了.不过没办法,现在就需要你用Java或者C++实现这样一个功能! 比如将下表无序的数据通过重排之后按照以下规 ...
 - GridView多列排序
		
public class WebGridView:GridView { 属性#region 属性 /**//// <summary> /// 是否启用或者禁止多列排序 /// </s ...
 - DataGridView的自定义列排序
		
1,将需要进行排序的列做属性的设置 this.colUserName.SortMode = DataGridViewColumnSortMode.Programmatic; 2,添加列的事件 //点击 ...
 - 你可能不知道的Linux/GNU bash sort多列排序功能
		
(转载请注明原创于潘多拉盒子) Linux man pages的缺点就是,如果你不会用某个命令,那么看完了多半还是不会.原因是,没有例子!比较囧吧? sort是提供了多列排序的功能的.通过-k选项,可 ...
 - Bootstrap 列偏移\列嵌套\列排序
		
1.列偏移 这个其实很简单就是通过一个样式类,通过.col-md-offset-*可以将列偏移到右侧.这些class通过使用*选择器将所有列增加了列的左侧margin.例如,.col-md-offse ...
 
随机推荐
- Evaluate Reverse Polish Notation leetcode java
			
题目: Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are + ...
 - AIDL 定向tag IPC 案例 MD
			
Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...
 - c#逐行分元素读取记事本txt数据写进数据库
			
其实这里最关键的一个方法是 StreamReader类里的 ReadLine();这个方法可以逐行读取txt流里面的数据.写了个简单的demo,已经加上了详细的注释说明. ok,好了,不废话,下面 ...
 - (转)在ios android设备上使用 Protobuf (使用dll方式)
			
自:http://game.ceeger.com/forum/read.php?tid=13479 如果你的工程可以以.Net 2.0 subset模式运行,请看这个帖子中的方法. 地址:http:/ ...
 - 动态改变UIPopupList选项(NGUI)
			
NGUI的UIPopupList 可以通过修改items属性来动态改变菜单选项: public class popListvahnge : MonoBehaviour { public UIPopup ...
 - Lessons learned developing a practical large scale machine learning system
			
原文:http://googleresearch.blogspot.jp/2010/04/lessons-learned-developing-practical.html Lessons learn ...
 - (转)机器学习的数学基础(1)--Dirichlet分布
			
转http://blog.csdn.net/jwh_bupt/article/details/8841644 这一系列(机器学习的数学基础)主要包括目前学习过程中回过头复习的基础数学知识的总结. 基础 ...
 - C#.NET常见问题(FAQ)-listView如何显示网格线
			
把GridLines设置为True 更多教学视频和资料下载,欢迎关注以下信息: 我的优酷空间: http://i.youku.com/acetaohai123 我的在线论坛: http:/ ...
 - 火狐浏览器Firefox Firebug使用方法
			
什么是Firebug 从事了数年的Web开发工作,越来越觉得现在对WEB开发有了更高的要求.要写出漂亮的HTML代码:要编写精致的CSS样式表展示每个页面模块:要调试javascript给页面增加一些 ...
 - 微信小程序 - 反编译线上源码
			
github地址:https://github.com/qwerty472123/wxappUnpacker 不过我好像从来未成功过哈,TX地图+.TX公交都失败了 点击下载以上两个文件 哦,对了,你 ...