正在阅读:如何给DataGrid添加双题头分类显示如何给DataGrid添加双题头分类显示

2004-05-12 14:37 出处:CSDN 作者:cuike519 责任编辑:linjixiong

               cellPerson.BackColor = Color.Navy;
               cellPerson.ForeColor = Color.Yellow;
               cellPerson.ColumnSpan = 3;
               cellPerson.HorizontalAlign = HorizontalAlign.Center;
               cellPerson.Controls.Add(new LiteralControl("个人信息"));
 
               TableCell cellJob = new TableCell();
               cellJob.BackColor = Color.Navy;
               cellJob.ForeColor = Color.Yellow;
               cellJob.ColumnSpan = 2;
               cellJob.HorizontalAlign = HorizontalAlign.Center;
               cellJob.Controls.Add(new LiteralControl("工作信息"));
               e.Item.Controls.Add(cellJob);
               m_CreatePageTimes  ++;
            }else if(m_CreatePageTimes ==1){
               // create custom pager UI
            }
         }

    最后是DataGrid的HTML部分的代码如下:
  <asp:DataGrid id="DataGrid1" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="100%"
     PageSize="2">
     <Columns>
      <asp:BoundColumn DataField="name" HeaderText="姓名"></asp:BoundColumn>
      <asp:BoundColumn DataField="BirthDate" HeaderText="生日"></asp:BoundColumn>
      <asp:BoundColumn DataField="Country" HeaderText="国家"></asp:BoundColumn>
      <asp:BoundColumn DataField="Title" HeaderText="头衔"></asp:BoundColumn>
      <asp:BoundColumn DataField="HireDate" HeaderText="雇佣日期"></asp:BoundColumn>
     </Columns>
     <PagerStyle Position="TopAndBottom" Mode="NumericPages"></PagerStyle>
    </asp:DataGrid>

  运行效果如下所示:


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:
键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品