【发布时间】:2013-06-21 20:43:38
【问题描述】:
我在 Visual Studio 2010 上使用 DevExpress 的组件 GridView 时遇到问题。
我想做的很简单。我有一个按钮,当它被点击时,我想显示这样的消息:“gridview 中第 0 行的 X 列的值为 Y”。
按钮的代码也很简单:
Protected Sub b_test_Click(ByVal sender As Object, ByVal e As EventArgs) Handles b_test.Click
Dim aux As String
aux = t_tickets.GetRowValues(0, "numero_de_ticket").ToString
MsgBox(aux)
End Sub
这段代码运行良好,但它有一个奇怪的行为。
如果我选择 gridview 中的第一行,它可以正常工作。但是,如果我选择不同的行,单击按钮时会出现以下错误:
System.Data.MissingPrimaryKeyException: A primary key field specified via the KeyFieldName property is not found in the underlying data source. Make sure the field name is spelled correctly
我总是选择第一行。我不知道为什么当我选择不同的行时会出现此错误。
谁能帮帮我?
【问题讨论】:
标签: aspxgridview