Add a DataGrid on the brown!

zhaozj2021-02-16  67

We know that if the width of DataGrid is longer so that we can make it easy to divide the data, it is easy.

Let us look wrong, I think if our mouse moves to the DataGrid line, he can clearly display

We are fine, so well, now we start, first we know that DataGrid is explained in the client.

TABLE So we know that Table has TR and TD, TR is line, we only need to be on each TR.

OnMouseOver enters a javascript script to implement this function,

οnmοuseοut = "this.style.BackgroundColor = 'White'>

... This is the script seen from the client so we can bind data through DataGRD ItemDATABOUND event

This time will be added to in. The specific code is as follows: if (E.Item.ItemType == ListItemType.Item || E.Item.ItemType ==

ListitemType.alternatingItem) {E.Item.attributes.add

("OnMouseover", "this.style.backgroundcolor = 'silver'"); E.Item.attributes.add

("OnMouseout", "this.style.BackgroundColor = 'White');} This will turn the color into a Silver when the mouse is moved into a WHITE (very color). The previous judgment can also have the same effect when the mouse moves to Head and Foot, so that the script can be

Only generates it inside.

Or specify a column discoloration: if (E.Item.itemType == ListItemType.Item || E.Item.ItemType ==

ListitemType.alternatingItem) {E.Item.cells [2] .attributes.add

("onMouseover", "this.style.backgroundcolor = 'silver'"); E.Item.cells [2] .attributes.add

("OnMouseout", "this.style.backgroundcolor = 'white'");

Not only this, you can also specify the shape of the mouse to move to a column: E.Item.cells [3] .style ("cursoor") = "Hand" or click a single display message: E.Item.cells [3] .attributes.add ("onclick", "Alert ('you click on the ID is:"

E.Item.cells [0] .text "! ');"), etc. ...

Through this method, we can also add the effect of movement on the mouse to the line to appear prompts E.Item.cells [2] .attributes.add ("Title", "He you can add a prompt information");

After practical discovery, you can add a lot of JavaScript scripts that make your DataGrid look more vivid. Finish!

转载请注明原文地址:https://www.9cbs.com/read-23933.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.048, SQL: 9