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

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

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

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

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

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

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

</style> 

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

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

 

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

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

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

           //當(dāng)鼠標(biāo)移開時(shí)還原背景色 
           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è)置申請(qǐng)?jiān)蜃址@示長(zhǎng)度 
           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è)置審批備注字符串截取長(zhǎng)度 
           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)文章

最新評(píng)論

科尔| 永吉县| 黄龙县| 民和| 皮山县| 陇南市| 井冈山市| 阿尔山市| 仪征市| 西峡县| 海原县| 平舆县| 中方县| 武胜县| 本溪| 台中县| 阜阳市| 宜昌市| 云南省| 吐鲁番市| 陵川县| 新巴尔虎左旗| 新干县| 浑源县| 时尚| 康马县| 加查县| 巩留县| 临漳县| 尼玛县| 临沭县| 会理县| 浦江县| 徐水县| 宝山区| 宝鸡市| 新野县| 乡宁县| 钦州市| 芮城县| 江门市|