在点击asp.net的ListView亮点排 [英] asp.net listview highlight row on click
本文介绍了在点击asp.net的ListView亮点排的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何设置列表视图突出显示一行,当你点击一个链接,图片等,但我只是想知道是否可以将其设置为高亮显示一行当你点击它的任何细胞,不只是在predefined控制。
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.
这可能吗?
我的方式解决它会设置的onclick的每个< TD>
,但不知道如何重置当你点击另一个单元格的背景颜色。
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");
});
一个例子小提琴:
An example fiddle:
这篇关于在点击asp.net的ListView亮点排的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文