In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to achieve GridView interlaced discoloration and light rod effect in Asp.net, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Method 1: use the foreground with the background
1.aspx interlaced discoloration attribute ()
The copy code is as follows:
Set the mouse in the 1.aspx.cs background event as for the discoloration effect on a line
The copy code is as follows:
Protected void gvProjectList_RowCreated (object sender, GridViewRowEventArgs e)
{
E.Row.Attributes.Add ("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#eaeaea';"); / / this is the background of changing a line when the mouse moves over it.
E.Row.Attributes.Add ("onmouseout", "this.style.backgroundColor=currentcolor;"); / / restore when the mouse is removed
}
Method 2: JQuery method
1.aspx
First reference the jQuery function library, download it at http://jquery.com/, then write the css style, and then add the js code.
The copy code is as follows:
The copy code is as follows:
.even {
Background:#F5F5F5
}
.odd {
Background:#FFFFFF
}
.over {
Background:#CDE6FF
}
.tr _ chouse {
Background:#6AB1FF
}
The copy code is as follows:
$(document) .ready (function () {
$(".gridview tr:odd") .addClass ("odd"); / / Odd lines are set to "odd" style
$(".gridview tr:even") .addClass ("even"); / / even rows are set to "even" style
$(".gridview tr") .mouseover (function () {$(this) .addClass ("over");}) / / add "over" style when mouseover
.mouseout (function () {$(this) .removeClass ("over");}) / / remove the "over" style when mouseout
.click (function () {$(this) .toggleClass ("tr_chouse");}) / / when click adds or removes the "tr_chouse" style to achieve data column selection
});
[updated at 13:57:30 on February 18, 2013]
The copy code is as follows:
$(function () {$(".maingrid _ text tr:even") .addClass ("even"); $(".maingrid _ text tr:odd") .addClass ("odd")
$(".maingrid _ text tr") .hover (function () {$(this) .addClass ("table_hover")}, function () {$(this) .removeClass ("table_hover")})
});
Function EndRequestHandler () {
$(function () {$(".maingrid _ text tr:even") .addClass ("even"); $(".maingrid _ text tr:odd") .addClass ("odd")
$(".maingrid _ text tr") .hover (function () {$(this) .addClass ("table_hover")}, function () {$(this) .removeClass ("table_hover")})
});
}
Function reload () {Sys.WebForms.PageRequestManager.getInstance () .add_endRequest (EndRequestHandler);}
(document) .ready (function () {reload ();})
Thank you for reading this article carefully. I hope the article "how to achieve GridView interlaced discoloration and light stick effect in Asp.net" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.