评论(0)

如何给DataGrid添加双题头分类显示

2004-05-12 14:37 cuike519 A+

               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>

  运行效果如下所示:

"


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:
打开客户端,无广告困扰,阅读更专注

热门新闻

推荐内容