使用jquery在asp.net网格视图中访问每一行 [英] Accessig Each Row in a asp.net grid view using jquery
本文介绍了使用jquery在asp.net网格视图中访问每一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的.aspx页面包含一个 id =gridview1
的网格视图。它是一个有界的网格视图,放在一个更新面板中,它包含一个带复选框的模板字段。
我想突出显示网格视图中的行,因为鼠标移动在网格上移动并想要更改单击复选框时网格行的颜色。
< asp:GridView ID = GridView1 runat = server AutoGenerateColumns = False BorderWidth = 0px CellPadding = 0 CellSpacing = 1 < span class =code-attribute> DataKeyNames = Cr_rowid ForeColor = #333333 GridLines = 无 ShowFooter = True 宽度 = 16px >
< RowStyle BackColor = #FFFBD6 ForeColor = #333333 HorizontalAlign = 中心 / >
< 列 >
< asp:BoundField DataField = Slno HeaderText = SlNo / >
< asp:BoundField DataField = Accessory_code HeaderText = 代码 < span class =code-attribute> / >
< asp:BoundField DataField = QtyNeeded HeaderText = QtyNeeded / >
< asp:TemplateField HeaderText = 选择 >
< ItemTemplate > ;
< asp:CheckBox ID = chk_select runat = 服务器 AutoPostBack = True
< span class =code-attribute> < span class =code-attribute> oncheckedchanged = chk_select_CheckedChanged / >
< / ItemTemplate >
< / asp:TemplateField >
< /列 >
< / asp:GridView >
我在 onDocumentReady()
中尝试了这段代码,然后在 pageLoad里面( )
但两者都不起作用。
如何在客户端访问网格视图行。
$(' #GridView1 tr:has(td )')。mouseover( function (){
$( this ) .addClass(' highlightRow');
});
$(' #GridView1 tr')。mouseout( function (){
$( this )。removeClass('' highlightRow');
})
解决方案
( ' #GridView1 tr:has(td)')。mouseover( function (){
( this )。addClass(' highlightRow');
});
(' #GridView1 tr')。mouseout( function (){
My .aspx page contains a grid view with id="gridview1"
. It is a bounded grid view and placed inside a update panel it contains a template field with check box.
I would like to highlight rows in grid view as the mouse move moves over the grid and want to change color of grid row when the check box is clicked.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderWidth="0px" CellPadding="0" CellSpacing="1" DataKeyNames="Cr_rowid" ForeColor="#333333" GridLines="None" ShowFooter="True" Width="16px">
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" HorizontalAlign="Center" />
<Columns>
<asp:BoundField DataField="Slno" HeaderText="SlNo" />
<asp:BoundField DataField="Accessory_code" HeaderText="Code" />
<asp:BoundField DataField="QtyNeeded" HeaderText="QtyNeeded" />
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chk_select" runat="server" AutoPostBack="True"
oncheckedchanged="chk_select_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I have tried this code inside onDocumentReady()
and then inside pageLoad()
but both do not work.
How can I access row of grid view at client side.
$('#GridView1 tr:has(td)').mouseover(function() {
$(this).addClass('highlightRow');
});
$('#GridView1 tr').mouseout(function() {
$(this).removeClass('highlightRow');
})
解决方案
('#GridView1 tr:has(td)').mouseover(function() {
(this).addClass('highlightRow'); });
('#GridView1 tr').mouseout(function() {
这篇关于使用jquery在asp.net网格视图中访问每一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文