【发布时间】:2012-03-30 22:58:10
【问题描述】:
这是应用程序:
有一些行的网格视图。当用户在 Web 表单上单击编辑时,它会打开几个字段进行编辑。我正在尝试做的是当 RowUpdating 触发时,检查网格视图中一个字段的值并验证其在某个范围内,然后在其超出该范围时取消。
我实际上已经完成了几乎所有的框架,除了我无法从 GridView 中的字段中获取值。
我和其他几个人一起搜索了这个网站,都列出了一些解决方案,但没有一个有效。我得到无法转换为字符串/整数,以及其他一些。
有什么建议吗?这是我的最新消息:
Private Sub gvCourses_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvCourses.RowUpdating
Dim x As String
x = gvCourses.SelectedRow.Cells[3].Text
MsgBox(x) ' Just a check to see if I get the variable to display the correct value, not part of the final app
我还尝试了上述的不同变体,但都没有奏效。上面我得到的 System.Web.UI.WebControls.TableCellCollection 不能转换成字符串。
我见过几个例子,但没有一个有效。有人有什么建议吗?
谢谢。
【问题讨论】: