zoukankan
html css js c++ java
GridView控件在没有数据时显示表头和没有数据
一、EmptyDataTemplate,在这个模版中设置
<
EmptyDataTemplate
>
<
table
>
<
tr
>
<
td
></
td
>
<
td
></
td
>
<
td
></
td
>
</
tr
>
<
tr
>
<
td
>
--没有记录--
</
td
>
</
tr
>
</
table
>
</
EmptyDataTemplate
>
二、数据源为datatable
DataTable dt
=
userbll.GetList(
""
).Tables[
0
];
if
(dt.Rows.Count
==
0
)
{
dt.Rows.Add(dt.NewRow());
GridView1.DataSource
=
dt;
GridView1.DataBind();
int
columnCount
=
dt.Columns.Count;
GridView1.Rows[
0
].Cells.Clear();
GridView1.Rows[
0
].Cells.Add(
new
TableCell());
GridView1.Rows[
0
].Cells[
0
].ColumnSpan
=
columnCount;
GridView1.Rows[
0
].Cells[
0
].Text
=
"
---没有记录---
"
;
GridView1.Rows[
0
].Cells[
0
].Style.Add(
"
text-align
"
,
"
center
"
);
}
else
{
GridView1.DataSource
=
dt;
GridView1.DataBind();
}
}
查看全文
相关阅读:
编译安装php
CentOS yum 安装LAMP PHP5.4版本
CentOS下php安装mcrypt扩展
CentOS安装crontab及使用方法(转)
解决svn "cannot set LC_CTYPE locale"的问题
CentOS下通过yum安装svn及配置
linux svn启动和关闭
vagrant启动报错The following SSH command responded with a no
并行进程问题
利用集群因子优化
原文地址:https://www.cnblogs.com/puke/p/773108.html
最新文章
行链接和行迁移
读UNDO引发的db file sequential read
db file scattered read
分区裁剪
buffer busy wait
基于SQL_ID查看对象大小
11g v$session定位客户端IP
Oracle 用户权限管理
等待事件--db file sequential read
数据结构
热门文章
leetcode 67 Add Binary
DP Big Event in HDU
DP Big Event in HDU
第一次使用优先队列
第一次使用优先队列
大数加法
JUnit实战(2)
Django入门(1)
mb_strlen(,utf-8);可以除去中文字符,统一返回是几个字符
安装php先行库
Copyright © 2011-2022 走看看