今天就跟大家聊聊有關(guān)使用gridview怎么對(duì)字符串進(jìn)行截取,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
首先在前臺(tái)設(shè)置樣式
復(fù)制代碼 代碼如下:
然后在后臺(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)移開(kāi)時(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 = "
看完上述內(nèi)容,你們對(duì)使用gridview怎么對(duì)字符串進(jìn)行截取有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。