代码之家  ›  专栏  ›  技术社区  ›  vondip

如何设置复选框内部的颜色-asp.net

  •  0
  • vondip  · 技术社区  · 15 年前

    2 回复  |  直到 13 年前
        1
  •  2
  •   BC.    13 年前

    你不能用css做到这一点。众所周知,表单很难设计样式( technical explanation from Eric Meyer

    但是,您可以使用javascript将复选框完全替换为图像,但仍然保留普通checkbox元素的格式编码。 Here's an example using jquery

        2
  •  1
  •   Sergey Glotov Nitesh Khosla    13 年前
    Public Sub SetColor()
        Try
            For i As Integer = 0 To gvMaster.Rows.Count - 1
                FN = gvMaster.Rows(i).Cells(3).Text
                If FN = "Present" Then
                    gvMaster.Rows(i).Cells(3).ForeColor = Color.Green
                End If
                If FN = "Absent" Then
                    gvMaster.Rows(i).Cells(3).ForeColor = Color.Red
                End If
    
                AN = gvMaster.Rows(i).Cells(4).Text
                If AN = "Present" Then
                    gvMaster.Rows(i).Cells(4).ForeColor = Color.Green
                End If
                If AN = "Absent" Then
                    gvMaster.Rows(i).Cells(4).ForeColor = Color.Red
                End If
            Next
        Catch generatedExceptionName As Exception
        End Try
    End Sub
    
    推荐文章