zoukankan      html  css  js  c++  java
  • GridView绑定数据源,无记录时表头也显示的一种解决方法

    public void BuildNoRecords(GridView gridView, DataSet ds)
    {
    try {
    if (ds.Tables(0).Rows.Count == 0) {
    ds.Tables(0).Rows.Add(ds.Tables(0).NewRow());
    gridView.DataSource = ds;
    gridView.DataBind();
    int columnCount = gridView.Rows(0).Cells.Count;
    gridView.Rows(0).Cells.Clear();
    gridView.Rows(0).Cells.Add(new TableCell());
    gridView.Rows(0).Cells(0).ColumnSpan = columnCount;
    gridView.Rows(0).Cells(0).Text = "No Records Found.";
    }
    } catch (Exception ex) {
    }  
  • 相关阅读:
    【心情】codeforces涨分啦!
    redis
    rabbitmq
    lucene
    MongoDB
    负载均衡
    分布式存储
    Memcache
    websocket
    Remoting
  • 原文地址:https://www.cnblogs.com/jcomet/p/1242441.html
Copyright © 2011-2022 走看看