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();
}
}
查看全文
相关阅读:
滑动窗口算法-2
滑动窗口算法-1
工作中缓存使用重点
QPS的计算方法[转载]
springAop
spring配置详述与springboot
LRU最少使用
图片压缩
Javassist使用[转载]
[转]关于Spring事务嵌套回滚的一些测试总结
原文地址:https://www.cnblogs.com/puke/p/773108.html
最新文章
jQuery——事件和AJAX
jQuery——修改DOM
redis.exceptions.ConnectionError: Error 10061 connecting to 127.0.0.1:6379. 由于目标计算机积极拒绝,无法连接。.
Python MySQL connector
MySQL——mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not support
navicat for mysql 连接报错1251详细解决步骤
python导入模块报错:ModuleNotFoundError: No module named 'mysql'
Python 虚拟环境介绍与安装
python—— reload(sys)报错 “name 'reload' is not defined”
文本框输入大于0的正整数
热门文章
Android开发,待了3年的小创公司突然没了,上哪去找我的“坑位”
Android开发5年,面试问到底层实现原理,被怼得“体无完肤”
做了三年Android,公司发不出工资了,怎么办?
秋招斩获OPPO意向书,方向是搞 Android Framework,一点顾虑让我选择了放弃。
30 岁了,我浪费了自己职业生涯的黄金 5 年,我能否还能回到程序员岗位上。如果再培训,学什么好?
字节跳动Android面试在线被虐指南
移动开发程序员最大的悲哀是什么?
牛逼了【Android逆向】小白也能学会的一个小时破解某猫社区VIP会员!
面对突如其来的阿里一面,我慌了!
使用 Flutter 快速实现聊天应用
Copyright © 2011-2022 走看看