Private Sub dg_news_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg_news.ItemCommand
'e.Item is the row of the table where the button was clicked.
Dim ID As String
If (e.CommandName = "编辑") Then
ID = e.Item.Cells.Item(6).Text.ToString
Response.Redirect("editfiles.aspx?id=" & ID)
End If
If (e.CommandName = "删除") Then
ID = e.Item.Cells.Item(6).Text.ToString
delrow(ID)
End If
End Sub
Private Sub delrow(ByVal newsID As String)
Dim accessdata As New c_data()
Dim CommandText As String
Dim mycommand As New SqlCommand()
CommandText = "delete from 服务器资源下载 where id='" + Trim(newsID) + "'"
accessdata.dosql(CommandText, Application("constr"))
Response.Write("<script> alert('删除成功!')</script>")
Bind_dg_news()
End Sub