惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Last Watchdog
The Last Watchdog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
T
Tor Project blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
博客园_首页
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
Last Week in AI
Last Week in AI
月光博客
月光博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
博客园 - 叶小钗
NISL@THU
NISL@THU
C
Check Point Blog
K
Kaspersky official blog
N
News and Events Feed by Topic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
Arctic Wolf
T
Threatpost
GbyAI
GbyAI
L
LINUX DO - 热门话题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
N
News and Events Feed by Topic
Scott Helme
Scott Helme
P
Privacy International News Feed
The Register - Security
The Register - Security
G
GRAHAM CLULEY
Recorded Future
Recorded Future
Apple Machine Learning Research
Apple Machine Learning Research
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog
Project Zero
Project Zero
Cyberwarzone
Cyberwarzone
Webroot Blog
Webroot Blog
Microsoft Security Blog
Microsoft Security Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
DataBreaches.Net
J
Java Code Geeks
AWS News Blog
AWS News Blog
Help Net Security
Help Net Security
Engineering at Meta
Engineering at Meta
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
Google DeepMind News
Google DeepMind News

博客园 - 水冰月

不要认为停留在心灵的舒适区域 成功不需要时间 只要你坚持 淘宝 世界名校的课件[转校内] 标题 javascript操作Select标记中options集合 七个受用一生的心理寓言 一辈子都有用的的75句话 完美的自己 一生中无能为力的10件事 xsd验证xml 浅谈asp.net2.0验证控件的安全使用 Javascript脚本和asp.net验证控件同时验证的代码 远程桌面“中断”巧解决 收集一些.NET开发资源站点和部分优秀.NET开源项目 XP实用技巧:恢复"显示桌面"按钮 在IE7.0中如何设置代理 Win 2003 Server重新安装Oracle9i 在windows xp环境下如何完全卸载 oracle9i
当DataSet为空时也显示GridView的表头(vs05) - 水冰月 - 博客园
水冰月 · 2008-04-25 · via 博客园 - 水冰月

/// <summary>
/// 当DataSet为空时也显示GridView的表头
/// </summary>
/// <param name="gridView">所要绑定的GridView</param>
/// <param name="ds">所要绑定的数据集</param>
/// <returns>void </returns>

public void BindNoRecords(GridView gridView, DataSet ds)
{
     
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 = "没有数据";
          gridView.RowStyle.HorizontalAlign
= System.Web.UI.WebControls.HorizontalAlign.Center;
     }

}
  

posted on 2008-04-25 18:19  水冰月  阅读(611)  评论(0)    收藏  举报