Mouse movement, change the DataGrid color

xiaoxiao2021-03-06  79

We know that if the width of DataGrid is longer so that we can make it easy to clear the line of data, it is easy to make us look wrong, I think if our mouse moves to the DataGrid line, he can clearly show us Ok, now, now we start, first we know that DataGrid is explained in the client to Table so we know that Table has TR and TD composition, TR is line, we only need to join onMouseover on each TR. A javaScript script can implement this function,

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 so you can also specify the mouse Moving to a column shape: E.Item.cells [3] .Style ("cursoor") = "Hand" or click a single unit display prompt information: E.Item.cells [3] .attributes.add ("Onclick", "Alert ('you click on the ID is:" E.Item.cells [0] .text "!');"), etc., we can also add it in the mouse by this method. The effect of prompts in the line E.Item.cells [2] .attributes.add ("Title", "Title can add prompt information"); After the practice, you can add a lot of JavaScript scripts when you are bound. Your DataGrid looks more vivid. Finish! Cuike519 [original] author blog:

http://blog.9cbs.net/cuike519/

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

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