我正在尝试动态gridview,其中包括Insert linkbutton。当布尔值为true时,将添加一个新的空行。这是vb.net服务器端代码:
Public Function GetList(Optional ByVal Insert As Boolean = False) As DataTable
Try
Dim query As String = "Select iPanelID, iPanelParentID, iOrder, iModelID, cModelTitle, cModelAbrv," &
" cModelCustodian, iAllowCreateFromPanel FROM Intranet.dbo.wf_Panel"
Dim dt As DataTable = AppCommon.AppFunctions.AppExecuteSelectDataset(CommandType.Text, query, , , , True).Tables(0)
If Insert Then
CType(gv_list.Rows(0).Cells(9).Controls(0), LinkButton).Text = "Insert"
Dim dr As DataRow = dt.NewRow()
dt.Rows.InsertAt(dr, 0)
gv_list.EditIndex = 0
End If
gv_list.DataSource = dt
gv_list.DataBind()
Return dt
Catch ex As Exception
End Try
End Function
我在链接按钮的操作上将布尔值设置为true。但它不起作用。唯一发生的事情是linkbutton更改为“Insert”
提前致谢。