How to intercept a medium GridView String method _ Practical Tips

Source: Internet
Author: User

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;

}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.