我有一個RowDataBound
與gridview
,尋找哪一年是活躍的,現在它有一個,它突出顯示。但讓我們說,我想再次活躍一年,但仍然突出顯示,並且您點擊的那個也突出顯示。但我想在RowDataBound gridview所選顏色
VB:
Protected Sub grdFinYear_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdFinYear.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If grdFinYear.DataKeys(e.Row.RowIndex).Values("FIN_ID") = FIN_ID Then
Dim activeButton As Button = e.Row.FindControl("btnSelect")
activeButton.CssClass = "ActionButtonsActiveYear"
e.Row.BackColor = Color.FromArgb(0, 121, 139, 169)
Else
Dim makeActiveButton As Button = e.Row.FindControl("btnSelect")
makeActiveButton.CssClass = "ActionButtonsMakeThisYearActive"
End If
End If
End Sub
C#或VB幫助是值得歡迎的,所以我認爲它會不得不用這樣的selectedindexchange
。但這SUB
是一半沒用,不是嗎?
是的,在我的表單的負載中,我將FIN年設置到今年,所以也許在那裏我可以說,如果年份更改爲無論如何改變按鈕和HILIGHT。那是對的嗎? – TheUser