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

推荐订阅源

D
Docker
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Vercel News
Vercel News
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
罗磊的独立博客
H
Help Net Security
月光博客
月光博客
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
GbyAI
GbyAI
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 白水书生

招聘.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");