如何更改选定行的颜色在C#中的Web应用程序的网格? [英] How do I change color of selected Row in the Grid in C# web application?
本文介绍了如何更改选定行的颜色在C#中的Web应用程序的网格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想改变在网格中选择特定行的颜色。怎么可能为我的web应用程序?请给我建议。
I want to change the color of particular row selected in the grid. How is it possible for my web application? Please suggest me.
推荐答案
试试这个
<style type="text/css">
.row-highlight
{
background-color: Yellow;
}
.row-select
{
background-color: red;
}
</style>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
<script type="text/javascript">
$(function () {
var tr = $('#<%= GridView1.ClientID %>').find('tr');
tr.hover(
function () { // mouseover
$(this).addClass('row-highlight');
},
function () { // mouseout
$(this).removeClass('row-highlight');
}
);
tr.click(function() {
$(this).addClass('row-select');
});
});
</script>
这篇关于如何更改选定行的颜色在C#中的Web应用程序的网格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文