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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 水冰月

不要认为停留在心灵的舒适区域 成功不需要时间 只要你坚持 淘宝 世界名校的课件[转校内] 标题 - 水冰月 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)    收藏  举报