ASP.net 2.0 Learning 001: The mouse moves across the GridView line, and the foreground and background colors change

Source: Internet
Author: User
asp.net 1, right-click the GridView, select Properties--Events, select the RowDataBound property under Data, and double-click it.

2, under the "GridView1_RowDataBound" method to add the following code:

if (E.row.rowtype = = Datacontrolrowtype.datarow)
... {
Alternating color effects When you move the mouse to each item
E.row.attributes.add ("onmouseout", "this.style.backgroundcolor= ' white '; this.style.color= ' #003399 '");
E.row.attributes.add ("OnMouseOver", "this.style.backgroundcolor= ' #6699FF"; this.style.color= ' #8C4510 ');

}

3, save all files, run, and found the mouse in the "GridView" table within the range of movement, the background color of each row changes, the color of the text has changed.

4, this small meter is very practical, can be very eye-catching to see the record you are viewing.

5, the above information from the "Chengking (Zhengjian)" blog, thank you!




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.