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 第三列为名称,第四列为日期,第六列为超链接列,通过以上代码将第三列的内容加上(日期)显示在第六列超链接列,显示内容没问题,但是造成的问题是,超链接失效,变为普通列,没有链接功能,请问如何解决。
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 第三列为名称,第四列为日期,第六列为超链接列,通过以上代码将第三列的内容加上(日期)显示在第六列超链接列,显示内容没问题,但是造成的问题是,超链接失效,变为普通列,没有链接功能,请问如何解决。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货