First, set the style on the foreground
Copy codeThe Code is as follows:
<Style type = "text/css">
. Listover150
{
Width: 150px;
Text-align: left;
Overflow: hidden;
Text-overflow: ellipsis; // The ellipsis (...) for super-long settings.
White-space: nowrap;
}
</Style>
Then, set RowDataBind in the background GridView.
, With a few words to change the style settings of the mouse movement
Copy codeThe Code is as follows:
// List Loading
Protected void gv_showReport_RowDataBound (object sender, GridViewRowEventArgs e)
{
If (e. Row. RowType = DataControlRowType. DataRow)
{
// Restore the background color when you move the mouse away.
E. Row. Attributes. Add ("onmouseout", "this. style. backgroundColor = c ");
E. Row. Attributes. Add ("onmouseover", "c = this. style. backgroundColor; this. style. backgroundColor = '# f4fb '");
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 the length of the Request reason string.
String strDISC = e. Row. Cells [4]. Text. Trim ();
E. Row. Cells [4]. Text = "<div class =/" listover150/">" + strDISC + "</div> ";
E. Row. Cells [4]. ToolTip = strDISC; // move the cursor to display all
// Set the length of the approval remarks string
String str = e. Row. Cells [7]. Text. Trim ();
E. Row. Cells [7]. Text = "<div class =/" listover150/">" + str + "</div> ";
E. Row. Cells [7]. ToolTip = str;
}
}