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

推荐订阅源

Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
IT之家
IT之家
Vercel News
Vercel News
C
Check Point Blog
Google DeepMind News
Google DeepMind News
月光博客
月光博客
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog

博客园 - 白水书生

招聘.net开发工程师(1人) 有效期2005年7月底 无法在web服务器上启动调试 HTTP/1.0 503 FlexCell表格控件For .NET V1.0.6 BLOG集锦 Mobile P 4和Mobile P4 M 奥运开始了!!!!! SQL Server的系统表 解决编写导入dBase存储过程的遇到的问题 项目实施有感 问题多多!!盼高手啊!!! 今天遇到一个奇怪的问题!!无奈搞了半天也没解决,难道非要重装 周日加班!无奈中就自己炫耀一下!!! 都是IE 缓存惹的祸!! 2004年度北京八大手机集散地大巡礼 Reporting Services 出书了!!! 解决报表部署时数据源存在不能替换的问题 [转]北京好吃地点大全 2004年5月版 如何知道自己的计算机是否安装了.Net Framework 1.1
控制DataGrid里的内容换行与不换行 - 白水书生 - 博客园
白水书生 · 2004-08-18 · via 博客园 - 白水书生

//换行
DataGrid1.Attributes.Add("style","word-break:keep-all;word-wrap:normal");
当内容为数字 ,则必须
void DataGrid1_DataBound(Object sender, DataGridItemEventArgs e)
{
  if( e.Item.ItemType == ListItemType.Item ||
    e.Item.ItemType == ListItemType.AlternatingItem)
   e.Item.Cells[1].Text = "<nobr>" + e.Item.Cells[1].Text + "</nobr>";
}

或者
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
  {
   if(e.Item.ItemType ==ListItemType.Header||e.Item .ItemType==ListItemType.Item ||e.Item .ItemType ==ListItemType.AlternatingItem)
   {
    for(int i=0;i<e.Item .Cells .Count ;i++)
    {
     e.Item .Cells [i].Attributes .Add ("nowrap","nowrap");
    }
   }
  }
 
//自动换行
DataGrid1.Attributes.Add("style","word-break:break-all;word-wrap:break-word");