Highlighting of DataGridView

Source: Internet
Author: User

Watch the video again, see the video above the Data Grid the data in the highlight implementation function, which involves an event that is Datagrid1_itemdatabound . The implementation code is as follows:

Although the video above can be implemented, but in the VS2012 There is no such event, even the name of the control is different, VS2012 there's a control in it that's almost like this, called GridView , the same function can be implemented, the name of this function is called RowDataBound , specifically as follows:

<span style= "FONT-SIZE:10.5PT;" > </span><span style= "font-size:18px;" >        protected Voidgridview1_rowdatabound (object sender, GridViewRowEventArgs e)        {            if (E.row.rowtype = = Datacontrolrowtype.datarow)            {               e.row.attributes.add ("onmouseover", "currentcolor= This.style.backgroundcolor;this.style.backgroundcolor= ' yellow '; ");               E.row.attributes.add ("onmouseout", "this.style.backgroundcolor=currentcolor;");            }        } </span>


finally found: actually these two are the same. But the video we see may be a bit of a long history, but the general content is almost the same, called Data binding (databound), but the name has changed, said is a thing.

Summary: Video is not necessarily the right, but it must be classic, is the so-called not pay attention is the driving force of the discovery of problems, it is because of the video above a little difference, so that we can better find and now a little different, prompting us to compare, and further search information, enhance our hands-on ability, Improve our ability to solve problems.


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.