GridView ...行索引,通过单击GridView中的A按钮 [英] GridView...Index Of Row By Click On the A Button In GridView
问题描述
我有一个带有此列的网格视图:
第1列:从表中绑定的ID(标签)
第2列:从表绑定的名称(文本框)
第3列:按钮或超链接
而且我有一个SqldataSourse绑定了表的ID和名称
我想要通过单击按钮(或超链接)的索引或名称(文本框中的值)的一列(选定的列)
用于重定向到其他网页(示例,请参见其他...)
我想要一个C#代码,可以为我提供所选行按钮(或超链接)的索引或DataKeyNames
PLZ HELP ME
i have a grid view with this Columns :
Column 1: Id (label) Bind From Table
Column 2:Name(TextBox) Bind From Table
Column 3: Button Or Hyperlink
and I have a SqldataSourse that bind Id And Name from Table
i want index or Name(value in textbox) Of A Column(Selected Column) by Clicking on the Button(or Hyperlink)
for rediredt to other webpage(example See Other...)
I want a C# Code that Give Me Index or DataKeyNames Of Selected Row Button(Or Hyperlink)
PLZ HELP ME
推荐答案
您是否属于primaryKey行的值?如果是这样,那么这里是代码.
获取CurrentRows PrimaryKey或DataKeyNames:
Hi,
Are you pertaining to the value of the row which is primaryKey? if so, here are the code.
to get the CurrentRows PrimaryKey or DataKeyNames:
DatagridView1.Rows[DatagridView1.CurrentCell.RowIndex].Cells["ID"].Value.ToString()
这篇关于GridView ...行索引,通过单击GridView中的A按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!