我试图从RadGrid插入表单中获取值,然后使用存储过程从表单元素中将这些值插入SQL数据库中。当我使用RadGrid插入命令子命令运行以下代码时,会将空值插入数据库。
代码如下:
Protected Sub rg_InsertCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles rg.InsertCommand
Dim item As GridEditFormInsertItem = CType(e.Item, GridEditFormInsertItem)
Dim name As RadTextBox = TryCast(item.FindControl("txtName"), RadTextBox)
Dim str As String = name.Text
End Sub