我知道如何设置列表视图以在单击链接、图像等时突出显示一行,但我只是想知道是否可以将其设置为在单击任何单元格时突出显示一行,而不是只是在一个预定义的控件上.
I know how to set up listview to highlight a row when you click a link, image, etc but I am just wondering if it is possible to set it up to highlight a row when you click on any of its cells, not just on a predefined control.
这可能吗?
我的解决方法是设置每个 <td> 的 onclick,但不知道如何在单击另一个单元格时重置背景颜色.
I way around it would be to setup onclick of each <td> but no idea how to reset the background colour when you click on another cell.
你可以在客户端使用 Jquery:
You could use Jquery on the client side:
$("#myTable tr").click( function ()
{
$("#myTable tr").each(function () { $(this).removeClass("selected")});
$(this).addClass("selected");
});
小提琴示例:
http://jsfiddle.net/9pmcA/26/
这篇关于asp.net listview 在单击时突出显示行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
车牌检测有哪些好的算法?What are good algorithms for vehicle license plate detection?(车牌检测有哪些好的算法?)
Unity中图像的onClick事件onClick event for Image in Unity(Unity中图像的onClick事件)
运行总 C#Running Total C#(运行总 C#)
单击带有 JAvascript.ASP.NET C# 的超链接时删除目录Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(单击带有 JAvascript.ASP.NET C# 的超链接时删除目录)
从函数调用按钮 OnClickCalling A Button OnClick from a function(从函数调用按钮 OnClick)
ASP.net C# Gridview ButtonField onclick 事件ASP.net C# Gridview ButtonField onclick event(ASP.net C# Gridview ButtonField onclick 事件)