gridview 显示前几个字 怎么在 girdview 里面显示 字段的前几个字呢?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考在gridview的OnRowDatabound事件里面写如下代码if(数据行)(e.row.rowindex>=0){ string temp= e.row.cells[i].Text; e.row.cells[i].Text = temp.substring(....); .....} 模板页面放个<asp:Literal ID="ltContent" runat="server" /> protected void rpXinyu_ItemDataBound(object sender, RepeaterItemEventArgs e){ //内容 Literal lt = e.Item.FindControl("ltContent") as Literal; string content = SQLUtil.CheckStr(drv["content"].ToString()); if (content.Length > 500) { lt.Text = SQLUtil.CheckStr(content.PadLeft(500).Substring(0,500) + "....."); } else { lt.Text = content; }} <%# Eval("yourText").ToString().Substring(0, 10) %> <%# Eval("yourText").ToString().Substring(0, 10)+"..." %> MVC 页面传值 小白系列之有关select 一个页面两个form提交 高手指点一下!解决如下问题。 关于时间格式的问题! 如何不让代码中的&在网页中变成& 能否往<head>或者<body>中输出js脚本? ★★★★★★怎么判断Cookie过期啊??★★★★★★★ 给单位做个在线直播及音频采集系统,请.net大侠们给些思路. .net连oracle的问题 Response.end() 什么时候用? CSS样式显示不正常
if(数据行)(e.row.rowindex>=0)
{
string temp= e.row.cells[i].Text;
e.row.cells[i].Text = temp.substring(....);
.....
}
protected void rpXinyu_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
//内容
Literal lt = e.Item.FindControl("ltContent") as Literal;
string content = SQLUtil.CheckStr(drv["content"].ToString());
if (content.Length > 500)
{ lt.Text = SQLUtil.CheckStr(content.PadLeft(500).Substring(0,500) + "....."); }
else { lt.Text = content; }
}