zoukankan      html  css  js  c++  java
  • 手拼Table 前台显示

    一:前台

    1 <table border="1" cellpadding="3" cellspacing="1" width="100%" id="TblList" runat="server" bordercolor="#D6DFF7">
    2</table>

    二:后台

     1 //表头
     2         public void TABTITLE()
     3         {
     4             TblList.Rows.Clear();
     5 
     6             HtmlTableRow Row;
     7             HtmlTableCell Cell;
     8 
     9             Row = new HtmlTableRow();
    10             Row.Attributes.Add("align", "center");
    11 
    12             Cell = new HtmlTableCell();
    13             Cell.Attributes.Add("align", "center");
    14             Cell.RowSpan = 1;
    15             Cell.InnerHtml = "编 号";
    16             Row.Cells.Add(Cell);
    17 
    18             Cell = new HtmlTableCell();
    19             Cell.Attributes.Add("align", "center");
    20             Cell.RowSpan = 1;
    21             Cell.InnerHtml = "标 题";
    22             Row.Cells.Add(Cell);
    23 
    24             Cell = new HtmlTableCell();
    25             Cell.Attributes.Add("align", "center");
    26             Cell.RowSpan = 1;
    27             Cell.InnerHtml = "发送时间";
    28             Row.Cells.Add(Cell);
    29 
    30             Cell = new HtmlTableCell();
    31             Cell.Attributes.Add("align", "center");
    32             Cell.RowSpan = 1;
    33             Cell.InnerHtml = "部 门";
    34             Row.Cells.Add(Cell);
    35 
    36             TblList.Rows.Add(Row);
    37         }
     1 public void Bind(string sqlwhere)
     2         {
     3             TABTITLE();
     4             DataSet ds = GetData(sqlwhere);
     5 
     6             int n = ds.Tables[0].Rows.Count;
     7             int i = 0;
     8             for (i = 0; i < n; i++)
     9             {
    10                
    11                 HtmlTableRow Row;
    12                 HtmlTableCell Cell;
    13 
    14                 Row = new HtmlTableRow();
    15                 Row.Attributes.Add("align", "center");
    16                 Row.Attributes.Add("bgcolor", "white");
    17 
    18                 Cell = new HtmlTableCell();
    19                 Cell.InnerHtml = (i + 1).ToString();
    20                 Row.Cells.Add(Cell);
    21 
    22                 Cell = new HtmlTableCell();
    23                 Cell.InnerHtml = ds.Tables[0].Rows[i]["title"].ToString();
    24                 Row.Cells.Add(Cell);
    25 
    26                 Cell = new HtmlTableCell();
    27                 Cell.InnerHtml = ds.Tables[0].Rows[i]["ngrq"].ToString();
    28                 Row.Cells.Add(Cell);
    29 
    30                 Cell = new HtmlTableCell();
    31                 Cell.InnerHtml = ds.Tables[0].Rows[i]["uname"].ToString();
    32                 Row.Cells.Add(Cell);
    33 
    34                 TblList.Rows.Add(Row);
    35             }
    36 
    37 
    38         }
  • 相关阅读:
    C# UrlDecode将+替换为空格问题
    Hashtable无序,用Dictionary代替
    Oracle查找Web执行SQL
    远程连接Oracle服务器
    asp.net core网站SSL nginx配置
    Supervisor踩过的坑
    centos nginx配置支持WebSocket(signalR)
    SignalR在asp.net core下使用
    Hangfire 在asp.net core环境的使用
    liteUploader上传控件的封装使用
  • 原文地址:https://www.cnblogs.com/fjptwwf/p/5416940.html
Copyright © 2011-2022 走看看