全部。我有一个带有Columns的datagridview。我需要能够在已填充的网格中添加空白行。我有10个文本框和一个按钮" ADD。"按钮单击事件时,它应该将空行添加到datagridview,但是它无法正常运行。我没有得到任何类型的错误,我的代码似乎没问题。请提前感谢您的帮助。
这是我的守则背后。 Default.aspx.vb
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged
End Sub
Protected Sub Operations_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) _
Handles Operations.RowCommand
Insert data if the CommandName == "Insert"
and the validation controls indicate valid data...
If e.CommandName = "Insert" AndAlso Page.IsValid Then
Insert(New record)
SQLDATASOURCE1.Insert()
End If
End Sub
Protected Sub SQLDATASOURCE1_Inserting _
(sender As Object, e As .ObjectDataSourceMethodEventArgs) _
Handles SQLDATASOURCE1.Inserting
Dim OPN_NUMBER As TextBox = _
Operations.FooterRow.FindControl("OPN_NUMBER")
Dim OPN_Desc As TextBox = _
Operations.FooterRow.FindControl("OPN_DESC")
Dim OPN_GL_ACCT As Textbox = _
Operations.FooterRow.FindControl("OPN_GL_ACCT")
Dim OPN_COST_CENTER As TextBox = _
Operations.FooterRow.FindControl("OPN_COST_CENTER")
Dim OPN_IND_LABOR As TextBox = _
Operations.FooterRow.FindControl("OPN_IND_LABOR")
Dim OPN_DIR_LABOR As TextBox = _
Operations.FooterRow.FindControl("OPN_DIR_LABOR")
Dim OPN_Non_OT As TextBox = _
Operations.FooterRow.FindControl("OPN_NON_OT")
Dim OPN_STATUS As TextBox =_
Operations.FooterRow.FindControl("OPN_STATUS")
Dim OPN_UPDATED As TextBox = _
Operations.FooterRow.FindControl("OPN_UPDATED")
Dim OPN_UPDATED_BY As TextBox = _
Operations.FooterRow.FindControl("OPN_UPDATED_BY")
End Sub