<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. homogeneous clip space and NDC

    CVV  canonical view volume HCS homogeneous clip space NDC nomolized device coordinates pipeline 的 ge ...

  2. Bootstrap学习js插件篇之下拉菜单

    案例 通过此插件可以为几乎所有东西添加下拉菜单,包括导航条.标签页.胶囊式按钮. 用于导航条 导航条分为四个部分.第一部分导航头,第二部分导航列,第三部分form查询表单,第四部分导航列. <n ...

  3. NSURLSession下载和断点续传

    NSURLSession是iOS7之后新的网络接口,和经常用到NSURLConnection是类似的.在程序在前台时,NSURLSession与NSURLConnection可以相互的替代.但是当用户 ...

  4. HttpClient4.3.3 使用样例—获取静态资源

    HttpClient4.3.3 使用样例—获取静态资源 学习了:http://shihlei.iteye.com/blog/2067688

  5. 如何用命令行管理windows记住的用户名和密码

    cmdkey https://technet.microsoft.com/en-us/library/cc754243.aspx

  6. [Angular-Scaled web] 1. Architecture and file structure

    We build a project according to its features or based on simple MVC structure. Put all controller in ...

  7. 4. Add override methods to class

    1. In the class, right click 2. "Scource" 3. "Override / Implement Menthods" 4. ...

  8. Postfix接收邮件后转向运行特定的脚本

    本文主要參考:http://serverfault.com/questions/258469/how-to-configure-postfix-to-pipe-all-incoming-email-t ...

  9. 创建一个pre标签展开折叠的UI组件(原创)

    这些天练习UI组件的编写,顺便模仿一个h5版本的pre标签收缩展开的效果组件: 兼容ie8.9,谷歌,火狐: 图片效果如下: demo.html代码: <!DOCTYPE html> &l ...

  10. GoogleCpp风格指南 8)格式 _part1

    8 格式 Formatting 代码风格和格式确实比較任意, 但一个项目中全部人遵循同一风格是非常easy的; 个体未必允许下述每一处格式规则, 但整个项目服从统一的编程风格是非常重要的, 仅仅有这样 ...