听说可以用CSS使过长的字段隐起来吗?
字符串不能格式化真不方便...
----------------------------------------------------------------------
天台gridview中 加模版列
后台代码中
///
/// 注:一个汉字作为2个字符长度处理
///
///
要进行切割的字符串
///
返回的长度(自动识别中英文)
///
protected string CutString(string str, int len)
{
byte[] sarr = System.Text.Encoding.Default.GetBytes(str);
if (sarr.Length > len)
return System.Text.Encoding.Default.GetString(sarr, 0, len) + "...";
else
return str;
}
--------------------------------------------------------
给个参考吧
15?DataBinder.Eval(Container.DataItem,"content").ToString().Substring(0,15)+"...":DataBinder.Eval(Container.DataItem,"content").ToString()%>
删除
'">查看详情
--------------------------------------------------------
唉,模版列我也会加阿
有没有改动更小的方法,没有的话下午给楼上2位没人50分好了
--------------------------------------------------------
--------------------------------------------------------
接分
--------------------------------------------------------
在CS里面GRIDVIEW的事件截取 e.Row.Cells[2] 这是那个地段!选择框为0然后往后排
protected void gvFlash_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[2].Text=e.Row.Cells[2].Text.ToString().PadRight(50).Substring(0,50);
}
}