First set the style in the foreground
Copy Code code as follows:
<style type= "Text/css" >
. listover150
{
width:150px;
Text-align:left;
Overflow:hidden;
text-overflow:ellipsis;//Ultra Long set ellipsis
White-space:nowrap;
}
</style>
Then set in the Rowdatabind in the background gridview
, with a few words to change the style of the mouse movement settings
Copy Code code as follows:
List load Handling
protected void Gv_showreport_rowdatabound (object sender, GridViewRowEventArgs e)
{
if (E.row.rowtype = = Datacontrolrowtype.datarow)
{
Restore background color When the mouse moves away
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)
{
Set request reason string display length
String strdisc = E.row.cells[4]. Text.trim ();
E.ROW.CELLS[4]. Text = "<div class=/" listover150/">" + Strdisc + "</div>";
E.ROW.CELLS[4]. ToolTip = strdisc;//Mouse put up to show all
Set approval memo string intercept length
String str = e.row.cells[7]. Text.trim ();
E.ROW.CELLS[7]. Text = "<div class=/" listover150/">" + str + "</div>";
E.ROW.CELLS[7]. ToolTip = str;
}
}