zoukankan      html  css  js  c++  java
  • aspxgridview 增加行号

    近日,是项目中要用到 DEVEXPRESS的ASPxGridView控件,要求能自动显示行号,现将代码共享一下。

    aspx页面:===========================================

     <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" KeyFieldName="Id"  Width="100%"
        oncustomunboundcolumndata="ASPxGridView1_CustomUnboundColumnData"
                                ClientIDMode="AutoID">
                                <Columns>
                                    <dx:GridViewDataTextColumn Caption="序号" FieldName="hh" UnboundType="Integer">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataColumn Caption="工作类型" FieldName="TaskType">
                                    <DataItemTemplate>
                                    <%#GetProjectNodeName((int)Eval("TaskType"))%>
                                    </DataItemTemplate>                      
                                    </dx:GridViewDataColumn>

    </Columns>
                            </dx:ASPxGridView>

    cs代码部分:=========================================

            /// <summary>
            /// 显示行号
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void ASPxGridView1_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e)
            {
                if (e.Column.Caption == "序号" && e.IsGetData)
                    e.Value = (e.ListSourceRowIndex + 1).ToString();
            }

  • 相关阅读:
    SGU 106 The equation 扩展欧几里德
    poj 2478 Farey Sequence 欧拉函数前缀和
    uva 11752 The Super Powers 素数+大数判断大小
    Lightoj 1370 素数打表 +二分
    vijos 1250 最勇敢的机器人 分组背包+并查集
    Codeforces Round #366 (Div. 2) A , B , C 模拟 , 思路 ,queue
    BZOJ 4034: [HAOI2015]T2 树链剖分
    BZOJ 1057: [ZJOI2007]棋盘制作 悬线法求最大子矩阵+dp
    BZOJ 1260: [CQOI2007]涂色paint 区间DP
    BZOJ 1264: [AHOI2006]基因匹配Match 树状数组+DP
  • 原文地址:https://www.cnblogs.com/kainjie/p/3423067.html
Copyright © 2011-2022 走看看