Get the App
SLTechnology News&Howtos  ›  Development  › 

A tutorial on how to add mouse over and click events to GridView lines

Shulou Source: shulou.com Published: 2022-06-03 07:40:23 11月09日 Update

This article introduces the relevant knowledge of "how to add mouse passing and clicking events to GridView lines". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The copy code is as follows:

Protected void GridView1_RowDataBound (object sender, GridViewRowEventArgs e)

{

E.Row.Attributes.Add ("onmouseover", "cantithis.style.backgroundColoritythis.style.backgroundColorability95B8FF'")

E.Row.Attributes.Add ("onmouseout", "this.style.backgroundColor=c")

E.Row.Attributes ["style"] = "Cursor:hand"

Int count = GridView1.Rows.Count

String ID = ""

For (int I = 0; I < count; iTunes +)

{

ID = GridView1.DataKeys [I] .Value.ToString ()

GridView1.Rows [I] .Attributes. Add ("onclick", "newwin=window.open ('default3.aspx?ID=" + ID + ",' newwin','width=500,height=550')")

}

}

This is the end of the tutorial on how to add mouse over and click events to GridView lines. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Events tutorials methods mouse code content more knowledge practicality learning next dilemma reality situation articles cases editing websites industries processes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Microsoft OPPO Reno MySQL NVidia