我如何从数据网格视图中选择关节柱的特征值? [英] How I Can Select Perticular Value Of Perticular Colum From Data Gridview?
问题描述
请告诉我
如何从数据网格视图中选择特定Colum的特定值?
当我从数据网格视图中选择一行然后自动选择一个文本框值一个列
please tell me
how i can select particular value of particular Colum from data grid view?
when i select one row from data gride view then auto seclect one textbox value one colum
推荐答案
假设你正在尝试做这在一些代码隐藏的地方然后有一个函数来选择一个特定的行...
Assuming you are trying to do this in some code-behind somewhere then there is a function to select a particular row...
GridView1.SelectRow(x)
其中 x
是一个整数。
如果你想在那之后到达一个特定的列,那么你可以使用 Cells
属性,例如
where x
is an Integer.
If you want to get at a particular column after that then you can use the Cells
property, e.g.
aLabel.Text = GridView1.SelectedRow.Cells(y).Text
其中 y
是其他一些整数
如果您使用鼠标或键盘选择了特定单元格,则触发的事件将提供适当类型的参数 e
。它将具有使您能够确定选择/影响哪一行的属性。
例如,如果 e,则为System.Web.UI。 WebControls.GridViewRowEventArgs
是参数,然后是
where y
is some other Integer
If you have selected a particular cell with your mouse or keyboard then the event fired will provide a parameter e
of an appropriate type. It will have properties that will enable you to determine which row was selected / affected.
For example if e As System.Web.UI.WebControls.GridViewRowEventArgs
is the parameter then
e.Row().Cells(2)
将返回受影响行的第3列。有时您想要的属性将是AffectedRows - 使用智能感知来确定每个实例中您需要的属性。
此代码项目文章也应该对您有用 CodeProject常见问题系列1:ASP.NET GridView [ ^ ]
will return the 3rd column of the row being affected. Sometimes the property you want will be "AffectedRows" - use the intellisense to work out which one you need in each instance.
This codeproject article should also prove useful to you CodeProject Frequently Asked Questions Series 1: The ASP.NET GridView[^]
这篇关于我如何从数据网格视图中选择关节柱的特征值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!