I am creating one application using gridview of asp.net. Grid view containing one template which having 3 to 4 labels which bind from database values.One label of gridview tamplate forecolor is blue but after selecting row i want to change color to white to selected row label to white but my problem is all other label colors is changed but that blue color label color is remaining.
I am using following code to change color of all labels At gridview selectedindex changed event.
For i As Integer = 0 To GridView1.Rows.Count – 1
If i = GridView1.SelectedIndex Then
GridView1.SelectedRow.Attributes.Add("style", "background-image: url('images/weight-loss-li-over.gif'); color : white;")
Else
GridView1.Rows(i).ForeColor = Drawing.Color.Black
GridView1.Rows(i).Font.Bold = False
GridView1.Rows(i).Attributes.Remove("style")
End If
Next
pls give me any answer?
You have to change your code as follwos, i think it will help you.
If it not resolve your problem then let me know.