<asp:BoundField HeaderText="ファイル名" DataField="FILE_PATH" SortExpression="FILE_PATH" />
后台的 filePath = dr["a"].ToString() + "<br>" + dr["b"].ToString() + "\r\n" + dr["c"].ToString();现在无论我怎么写这个字段都不肯换行啊
我换了<br\> "\n" "\r" "\n\r" 还把asp:BoundFiled 属性 HtmlEncode=true
都没用
word-break:break-all;word-wrap:break-word
你能不能写全来挖。。
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].Width = 480;
e.Row.Cells[1].Width = 200;
}
}
<ItemStyle Wrap="true" />
PUBLIC FILE_PATH=dr["a"].ToString() + "<br>" + dr["b"].ToString() + "\r\n" + dr["c"].ToString();
DataField=<% "FILE_PATH">
我肯定是这里出的问题,把你的代码贴完整点
{
//Gridviewラップ
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[3].Text = StringUtil.KeepPre(e.Row.Cells[3].Text);
} }
public static string KeepPre(string html)
{
if (string.IsNullOrEmpty(html))
{
return html;
}
html = html.Replace("\n", "<br/>");
return html;
}
结贴了·`麻烦各位了