Private Sub datagrid1_ItemDataBound(ByVal sender As System.Object, ByVal e As DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
Dim checkbox As CheckBox
Dim item As DataGridItem
For Each item In DataGrid1.Items
'==================''点Checkbox时让行改变颜色============
checkbox = item.FindControl("Checkbox1")
Dim js As String = "if(this.checked==true) { this.parentElement.parentElement.style.backgroundColor='#ff00f6'; } else { this.parentElement.parentElement.style.backgroundColor='#ffff00';}"
checkbox.Attributes.Add("OnClick", js)
'===================End Code=============================
Next
引自Morock 's BLOG.htm