<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修改掉的更多相关文章

  1. 10个devexpress ASPxPivotGrid常见问题

    原文:10个devexpress ASPxPivotGrid常见问题 1.DXperience ASPxGridView如何开启lightweight模式 描述:ASPxGridView样式主题中pa ...

  2. Jtable 表格按多列排序(支持中文汉字排序)

    这两天公司让做一个Jtable表格的排序,首先按A列排序,在A列相等时按B列排序,B列相等时按C列排序,ABC三列可以任意指定,最多分三列,这样的一个需求.由于我是大神,所以必须做了出来.ok,不自恋 ...

  3. easyUI datagraid的列排序

    在给datagraid做多列排序时请注意: 首先,做的是后台排序,那么需要设置: remoteSort:'true', 然后,不要添加 multiSort:'true',这个是多列一起排序无法实现.. ...

  4. EF架构~真正被封装的排序方法,支持多列排序

    回到目录 对于linq to sql 和linq to entity来说,当你把获取数据的方法封装了之后,总觉得还缺点什么,想了之后,应该是排序,但看了微软的orchard项目之后,觉得它的排序封装的 ...

  5. 自定义多列排序:C++/Java实现

    前言: 有些时候,我们在编程中会遇到多列排序的需求.假如在execle,这事儿就太easy了.不过没办法,现在就需要你用Java或者C++实现这样一个功能! 比如将下表无序的数据通过重排之后按照以下规 ...

  6. GridView多列排序

    public class WebGridView:GridView { 属性#region 属性 /**//// <summary> /// 是否启用或者禁止多列排序 /// </s ...

  7. DataGridView的自定义列排序

    1,将需要进行排序的列做属性的设置 this.colUserName.SortMode = DataGridViewColumnSortMode.Programmatic; 2,添加列的事件 //点击 ...

  8. 你可能不知道的Linux/GNU bash sort多列排序功能

    (转载请注明原创于潘多拉盒子) Linux man pages的缺点就是,如果你不会用某个命令,那么看完了多半还是不会.原因是,没有例子!比较囧吧? sort是提供了多列排序的功能的.通过-k选项,可 ...

  9. Bootstrap 列偏移\列嵌套\列排序

    1.列偏移 这个其实很简单就是通过一个样式类,通过.col-md-offset-*可以将列偏移到右侧.这些class通过使用*选择器将所有列增加了列的左侧margin.例如,.col-md-offse ...

随机推荐

  1. UVA 156 (13.08.04)

     Ananagrams  Most crossword puzzle fans are used to anagrams--groupsof words with the same letters i ...

  2. Python 批量修改图片格式和尺寸

    公司的一个项目要求把所有4096x4096的图片全部转化成2048x2048的图片,这种批量转换图片大小的软件网上很多,我的同事原来使用的美图看看的批量转换,但是稍微有点麻烦,每次还需要指定要转换的图 ...

  3. HTML-<td> 标签的 valign 属性

    <html> <body> <table border="1" style="height:200px"> <tr&g ...

  4. vs2013 密钥_

    vs2013 密钥 最佳答案: BWG7X-J98B3-W34RT-33B3R-JVYW9

  5. [Backbone]6. Collections.

    Define a collection: var AppointmentList = Backbone.Collection.extend({model: Appointment}); RESET t ...

  6. easyui tree 搜索

    关键代码: var value=$('#txt_search').val(); var childrens = $('#regionTree').tree('getChildren'); $.each ...

  7. iOS中ActionSheet和Alert的区别

    首先,样子长得就不一样 看下图:

  8. Socket 之 传值方式

    一.传送 DataTable 和 DataSet 1.发送端需序列化数据为二进制序列化格式 public static byte[] GetBinaryFormatDataSet(DataSet ds ...

  9. redis 安装 命令

    安装: http://redis.io/download 在线操作命令:http://try.redis.io/ 命令查询:https://redis.readthedocs.org/en/lates ...

  10. vue 开发中的常见问题

    (一)eslint静态检查 在大家用vue-cli创建工程的时候,会有一项,使用使用eslint,如果选择了y,那么工程就会安装并启用eslint. 这里列举一下常见的错误: 1.多余的分号 2.定义 ...