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();
}
}
查看全文
相关阅读:
machine learning学习笔记
google detection
检查ftp备份数据完整性及短信告警的shell脚本
javascript获取url参数的方法
php随机生成福彩双色球号码
php 身份证号码获取星座和生肖
JS将搜索的关键字高亮显示实现代码
C#保存上传来的图片示例代码
window.onresize 多次触发的解决方法
setTimeout和setInterval的深入理解
原文地址:https://www.cnblogs.com/puke/p/773108.html
最新文章
hdu 4163 Stock Prices 水
hdu 3535 AreYouBusy 分组背包
BZOJ 3224: Tyvj 1728 普通平衡树 treap
LightOJ 1248 Dice (III) 概率
LightOJ 1079 Just another Robbery 概率背包
UVALive 6885 Flowery Trails 最短路枚举
UVALive 6884 GREAT + SWERC = PORTO dfs模拟
UVALive 6887 Book Club 最大流解最大匹配
HDU 4258 Covered Walkway 斜率优化DP
CodeChef DISTNUM2 Easy Queries 节点数组线段树
热门文章
51 NOD 1685 第K大区间2 二分+BIT
Gym 100971D Laying Cables 单调栈
cnn中的fp和bp推导
To do list
rnn,lstm and JuergenSchmidhuber
visual attention
rnn,cnn
convolution,fft, 加速
loss 和accuracy的关系梳理
matlab时间测试
Copyright © 2011-2022 走看看