最後,我發現了一個竅門。我不確定這是否是正確的方式,但是它對我有用。
Protected Sub GridView6_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView6.RowCommand
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim r As GridViewRow = GridView6.Rows(index)
Dim cell1 As Button = r.Cells(0).Controls(0)
Dim c1 As String = RTrim(cell1.Text)
Dim cell2 As Button = r.Cells(1).Controls(0)
Dim c2 As String = RTrim(cell2.Text)
Dim cell3 As Button = r.Cells(2).Controls(0)
Dim c3 As String = RTrim(cell3.Text)
Dim cellname As String = RTrim(e.CommandName)
If c1 = cellname Then
If cell1.BackColor = Drawing.Color.OliveDrab Then
cell1.BackColor = Drawing.Color.Linen
Else
cell1.BackColor = Drawing.Color.OliveDrab
End If
End If
// AND same for C2 and C3
它的工作方式都對顏色和變色;)
對不起,我沒有得到U,我只是創建一個rowcommand事件,所以我可以做一些其他的東西太喜歡「如果e.CommandName =‘全部’然後... –