ASP.NET的网格视图中选择行使用jQuery [英] Asp net grid view select row using jquery
本文介绍了ASP.NET的网格视图中选择行使用jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有asp.net网页上的正常gridview的...我想使用jQuery选择一个行,然后pressing一个按钮,id和descripcion列发送到Web服务...
I have a normal gridview on asp.net web page... I want to select a row using jquery and then pressing a button to send the id and descripcion columns to a web service...
我的问题是我怎么能选择该行,并得到了我想要的信息......所有使用jQuery。
My question is how can I select the row and get the information I want... all using jquery.
推荐答案
试着这么做
$('#<%=Grid.ClientID %>').delegate('tr', 'click', function(){
$('#<%=Grid.ClientID %> tr').not(this).removeClass('selectedRow');
$(this).toggleClass('selectedRow');
});
这应使您能够选择单击一个GridView中一行。
This should enable you to select a single GridView row on click.
在此之后,对于按钮控件,请使用以下
After that, for the button control, use the following
$('#<%=Btn.ClientID %>').click(function(){
alert($('#<%=Grid.ClientID %>').find('tr.selectedRow').html());
// code to call the webservice using columns from $('#<%=Grid.ClientID %>').find('tr.selectedRow')
// prevent Button control from causing a postback
return false;
});
这篇关于ASP.NET的网格视图中选择行使用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文