新手求救

aysnowwolf 2010-09-29 10:27:32
for (int i = 0; i < Count;i++ )
if (DataGrid1.Items[i].Cells[2].Text.ToString().Trim().Length > 40)
{
DataGrid1.Items[i].Cells[5].Text = DataGrid1.Items[i].Cells[2].Text.Substring(0, 40) + "..." + "(" + DataGrid1.Items[i].Cells[3].Text.ToString().Trim() + ")";
Label1.Text = DataGrid1.Items[i].Cells[5].Text.Length.ToString();
}
else
{
DataGrid1.Items[i].Cells[5].Text = DataGrid1.Items[i].Cells[2].Text + "(" + DataGrid1.Items[i].Cells[3].Text.ToString().Trim() + ")";
Label1.Text = DataGrid1.Items[i].Cells[5].Text.Length.ToString();
}


代码如上,datagrid 第三列为名称,第四列为日期,第六列为超链接列,通过以上代码将第三列的内容加上(日期)显示在第六列超链接列,显示内容没问题,但是造成的问题是,超链接失效,变为普通列,没有链接功能,请问如何解决。
...全文
87 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
K0528 2010-09-30
  • 打赏
  • 举报
回复
1樓太猛了...
aysnowwolf 2010-09-30
  • 打赏
  • 举报
回复
感謝,解決好了。
Olive_Guo 2010-09-30
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wuyq11 的回复:]
修改值(DataGrid1.Items[行].Cells[列].Controls[0] as HyperLink).Text
[/Quote]
++
三岁、就很帅 2010-09-30
  • 打赏
  • 举报
回复
膜拜楼上的……好多章啊
wuyq11 2010-09-29
  • 打赏
  • 举报
回复
修改值(DataGrid1.Items[行].Cells[列].Controls[0] as HyperLink).Text

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧