当前位置: 移动技术网 > IT编程>开发语言>.net > 关于中gridview 字符串截取的方法

关于中gridview 字符串截取的方法

2017年12月12日  | 移动技术网IT编程  | 我要评论

鬼吹灯之精绝古城下载迅雷,怪盗妃撞倒冷王爷,季季通国际机票网

首先在前台设置样式

复制代码 代码如下:

<style  type="text/css"> 
 .listover150 

width:150px; 
text-align:left; 
overflow:hidden; 
text-overflow:ellipsis;//超长设置省略号 
white-space:nowrap; 

</style> 

然后在后台gridview中的rowdatabind中进行设置

,附带几句可以改变鼠标移动的样式设置

 

复制代码 代码如下:

 //列表加载处理 
   protected void gv_showreport_rowdatabound(object sender, gridviewroweventargs e) 
   { 

       if (e.row.rowtype == datacontrolrowtype.datarow) 
       { 

           //当鼠标移开时还原背景色 
           e.row.attributes.add("onmouseout", "this.style.backgroundcolor=c"); 
           e.row.attributes.add("onmouseover", "c=this.style.backgroundcolor;this.style.backgroundcolor='#f4fbff'"); 
           e.row.attributes.add("onclick", "this.style.backgroundcolor='#e2eaf1'"); 
       } 
       if (e.row.rowtype == datacontrolrowtype.header) 
       { 
           e.row.attributes.add("style", "background-image:url('../images/grid3-hrow.gif')"); 
       } 
       if (e.row.rowtype == datacontrolrowtype.datarow) 
       { 
           //设置申请原因字符串显示长度 
           string strdisc = e.row.cells[4].text.trim(); 
           e.row.cells[4].text = "<div class=/"listover150/">" + strdisc + "</div>"; 
           e.row.cells[4].tooltip = strdisc;//鼠标放上去显示所有 

           //设置审批备注字符串截取长度 
           string str = e.row.cells[7].text.trim(); 
           e.row.cells[7].text = "<div class=/"listover150/">" + str + "</div>"; 
           e.row.cells[7].tooltip = str; 

       } 
   } 
 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网