我是用<asp:label>来做的,你可以先把数据都放到数组了,然后就数组的值通过循环放到<asp:label>里!给你一点代码看看!If Mid(strLast_Power_Data79, i + 1, 1) <> Mid(strTemp, i + 1, 1) Then If i Mod 8 = 1 Or i Mod 8 = 2 Or i Mod 8 = 0 Then If Mid(strTemp, i + 1, 1) = 1 Then '显示灰色 With CType(Page.FindControl("Image" + (CType(a(i), Int32)).ToString()), Image) .Width = Unit.Pixel(16) .Height = Unit.Pixel(16) .ImageUrl = "\webdel6/img/tubiaohui.jpg" End With ElseIf Mid(strTemp, i + 1, 1) = 0 Then '显示绿灯 With CType(Page.FindControl("Image" + (CType(a(i), Int32)).ToString()), Image) .Width = Unit.Pixel(16) .Height = Unit.Pixel(16) .ImageUrl = "\webdel6/img/tubiaolu.jpg" End With End If Else If Mid(strTemp, i + 1, 1) = 1 Then '显示红灯 With CType(Page.FindControl("Image" + (CType(a(i), Int32)).ToString()), Image) .Width = Unit.Pixel(16) .Height = Unit.Pixel(16) .ImageUrl = "\webdel6/img/tubiaohong.jpg" End With ElseIf Mid(strTemp, i + 1, 1) = 0 Then '显示灰色 With CType(Page.FindControl("Image" + (CType(a(i), Int32)).ToString()), Image) .Width = Unit.Pixel(16) .Height = Unit.Pixel(16) .ImageUrl = "\webdel6/img/tubiaohui.jpg" End With End If End If End If Next
If i Mod 8 = 1 Or i Mod 8 = 2 Or i Mod 8 = 0 Then
If Mid(strTemp, i + 1, 1) = 1 Then '显示灰色
With CType(Page.FindControl("Image" + (CType(a(i), Int32)).ToString()), Image)
.Width = Unit.Pixel(16)
.Height = Unit.Pixel(16)
.ImageUrl = "\webdel6/img/tubiaohui.jpg"
End With ElseIf Mid(strTemp, i + 1, 1) = 0 Then '显示绿灯
With CType(Page.FindControl("Image" + (CType(a(i), Int32)).ToString()), Image)
.Width = Unit.Pixel(16)
.Height = Unit.Pixel(16)
.ImageUrl = "\webdel6/img/tubiaolu.jpg"
End With End If
Else
If Mid(strTemp, i + 1, 1) = 1 Then '显示红灯
With CType(Page.FindControl("Image" + (CType(a(i), Int32)).ToString()), Image)
.Width = Unit.Pixel(16)
.Height = Unit.Pixel(16)
.ImageUrl = "\webdel6/img/tubiaohong.jpg"
End With ElseIf Mid(strTemp, i + 1, 1) = 0 Then '显示灰色
With CType(Page.FindControl("Image" + (CType(a(i), Int32)).ToString()), Image)
.Width = Unit.Pixel(16)
.Height = Unit.Pixel(16)
.ImageUrl = "\webdel6/img/tubiaohui.jpg"
End With End If
End If
End If
Next