D
Dave
Hi,
I want to change the color of two fields (a checkbox and a 'normal
stringfield') of my gridview depending of their value. The checkbox works
with the code below.
My question is: what do i have to take as object for the 'normal
stringfield'? I tried with 'textbox', with 'label' ... but each time i get
the error:
"Specified argument was out of the range of valid values. Parameter name:
index"
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles
GridView1.RowDataBound
Dim cb As New CheckBox
Dim a As ???
cb = e.Row.Cells(6).Controls(0)
a = e.Row.Cells(5).Controls(0)
If cb.Checked Then
e.Row.Cells(0).BackColor = Drawing.Color.Red
e.Row.Cells(6).BackColor = Drawing.Color.Red
End If
if a.text (or matbe a.value) = "fat" then
e.Row.Cells(6).BackColor = Drawing.Color.Green
End If
End Sub
Thanks
Dave
I want to change the color of two fields (a checkbox and a 'normal
stringfield') of my gridview depending of their value. The checkbox works
with the code below.
My question is: what do i have to take as object for the 'normal
stringfield'? I tried with 'textbox', with 'label' ... but each time i get
the error:
"Specified argument was out of the range of valid values. Parameter name:
index"
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles
GridView1.RowDataBound
Dim cb As New CheckBox
Dim a As ???
cb = e.Row.Cells(6).Controls(0)
a = e.Row.Cells(5).Controls(0)
If cb.Checked Then
e.Row.Cells(0).BackColor = Drawing.Color.Red
e.Row.Cells(6).BackColor = Drawing.Color.Red
End If
if a.text (or matbe a.value) = "fat" then
e.Row.Cells(6).BackColor = Drawing.Color.Green
End If
End Sub
Thanks
Dave