In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article focuses on "how to add colors and events to gridview row selection". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to add colors and events to gridview row selection.
In the gridview list, need to add the following effect, if after time change color, remove when reverting to the previous color, row selection by adding dark, so as to know which row is selected, especially when there is a lot of list data, the flag is very important, while triggering the selected row event, then how to add color in the row selection, while also starting our event? If we access e.Row.Attributes.Add ("onclick") and bind it twice, we find that only one of them can be triggered, but we can actually put the other into one.
Here are specific examples:
The copy code is as follows:
Protected void EditGridview_RowDataBound (object sender, GridViewRowEventArgs e)
{
If (e.Row.RowTypewriter = DataControlRowType.DataRow)
{
/ / save the background color of the current line and attach a color when the mouse is on it.
E.Row.Attributes.Add ("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='inactivecaptiontext',this.style.fontWeight='';this.style.cursor='hand';")
/ / restore the background color to its previous color when the mouse leaves
E.Row.Attributes.Add ("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';")
/ / darken the color flag when the mouse is clicked
E.Row.Attributes.Add ("onclick", "setvalue (); if (window.oldtrending null) {window.oldtr.runtimeStyle.cssText='';} this.runtimeStyle.cssText='background-color:#e6c5fc';window.oldtr=this")
}
}
Js Code:
The copy code is as follows:
Function setvalue () {
Alert ('row click event, change color at the same time')
}
At this point, I believe you have a deeper understanding of "how to add colors and events to gridview row selection". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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.