*********************************************************************.
2.(หน้าCode vb)
Sub modDeleteCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Dim strSql As String
strSql = "DELETE * FROM Major WHERE Major_Id =#######-- >'" & GridView1.DataKeys.Item(e.Item.ItemIndex) & "'" #######
com = New SqlCommand(strSql, conn)
com.ExecuteNonQuery()
GridView1.EditItemIndex = -1
Binddata()
End Sub
*********************************************************************
3.(หน้าCode VB)
Sub Gridview1_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
Dim lblMajor_Id As Label = CType(e.Item.FindControl("lblMajor_Id"), Label)
If Not IsNothing(lblMajor_Id) Then
lblMajor_Id.Text =####-- CType(e.Item.DataItem("Major_Id"), TextBox)--#####
End If