最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

關(guān)于中g(shù)ridview 字符串截取的方法

 更新時間:2013年06月22日 10:28:57   作者:  
在Gridview中,如果你的某一列字符串的長度過長,不做處理的話.那么將顯示的奇丑無比,可以采取設(shè)置樣式,將其顯示為定長,可以在點擊查看的時候,在另一個頁面對其進(jìn)行顯示

首先在前臺設(shè)置樣式

復(fù)制代碼 代碼如下:

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

width:150px; 
text-align:left; 
overflow:hidden; 
text-overflow:ellipsis;//超長設(shè)置省略號 
white-space:nowrap; 

</style> 

然后在后臺GridView中的RowDataBind中進(jìn)行設(shè)置

,附帶幾句可以改變鼠標(biāo)移動的樣式設(shè)置

 

復(fù)制代碼 代碼如下:

 //列表加載處理 
   protected void gv_showReport_RowDataBound(object sender, GridViewRowEventArgs e) 
   { 

       if (e.Row.RowType == DataControlRowType.DataRow) 
       { 

           //當(dāng)鼠標(biāo)移開時還原背景色 
           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) 
       { 
           //設(shè)置申請原因字符串顯示長度 
           string strDISC = e.Row.Cells[4].Text.Trim(); 
           e.Row.Cells[4].Text = "<div class=/"listover150/">" + strDISC + "</div>"; 
           e.Row.Cells[4].ToolTip = strDISC;//鼠標(biāo)放上去顯示所有 

           //設(shè)置審批備注字符串截取長度 
           string str = e.Row.Cells[7].Text.Trim(); 
           e.Row.Cells[7].Text = "<div class=/"listover150/">" + str + "</div>"; 
           e.Row.Cells[7].ToolTip = str; 

       } 
   } 
 

相關(guān)文章

最新評論

萨迦县| 波密县| 桂平市| 西藏| 徐州市| 南通市| 新乐市| 库车县| 沐川县| 随州市| 黄龙县| 那坡县| 霍邱县| 贡嘎县| 新乡市| 静海县| 大悟县| 稻城县| 大埔区| 滕州市| 宣威市| 凤山市| 商水县| 平山县| 黑龙江省| 广河县| 余江县| 绵竹市| 双流县| 化州市| 许昌县| 广州市| 胶南市| 旅游| 巨鹿县| 社会| 和田市| 察隅县| 南昌县| 磐石市| 阳江市|