gridview选择的行值 [英] gridview selected row values

查看:85
本文介绍了gridview选择的行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gridview一列链接按钮,让我选择第三行,但我需要输出第三行

推荐答案

您可以获取selected的值按以下方式排行,

Gridview1.SelectedRow.Cells [index] .Text;

哪里Gridview1-> Gridview的ID
索引->单元格编号
You can get values of selected row in following way,

Gridview1.SelectedRow.Cells[index].Text;

Where Gridview1 -> Id of Gridview
index -> cell No.




请参阅下面的链接.寻找解决方案可能会有所帮助.

http: //www.dotnetfunda.com/articles/article442-how-to-to-get-the-values-of-selected-row-from-a-gridview-using-aspnet.aspx [ http://r4r.co.in/asp.net/01/tutorial/asp.net/how_to_get_the_values_of_selecte.shtml [ ^ ]

谢谢,
Viprat
Hi,

See the below link. It may be help you to find the solution.

http://www.dotnetfunda.com/articles/article442-how-to-get-the-values-of-selected-row-from-a-gridview-using-aspnet.aspx[^]
http://r4r.co.in/asp.net/01/tutorial/asp.net/how_to_get_the_values_of_selecte.shtml[^]

Thanks,
Viprat



您需要玩datagridview的ItemCommand事件.当您单击链接按钮时(如您在第一列中所述),控件会将您带到该事件,您将在CommandEventArg e中获得选定的行.
只需执行以下操作

Hi,
you need to play with ItemCommand event of datagridview. as you click on the link button (as you said is in your first column) control will take you to that event where you would get the selected row inside CommandEventArg e.
just do as follows

bool val =  ((checkbox)e.item.findcontrol("yourCheckBoxName")).checked;



这样,您将获得复选框的值.



this way you would get the value of your check box.


这篇关于gridview选择的行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆