我要求我需要在使用itextsharp生成的pdf文档上显示复选框。但是,由于itextsharp不支持html输入标记,因此复选框没有出现在我的页面上。我使用asp.net checkboxlist控件,我正在考虑添加背景图像以显示复选框已选中或未选中,但由于某种原因,我无法让它显示仍然。这是我的代码:
Protected Sub Checkboxlist1_DataBound(sender As Object, e As EventArgs) Handles Checkboxlist1.DataBound
If test <> "" Then
Dim checklist As List(Of String) = ReturnListofStringClass.ReturnChecklistListOfString(test)
For i = 0 To Checkboxlist1.Items.Count - 1
For Each id As String In checklist
If Checkboxlist1.Items(i).Value = id Then
Checkboxlist1.Items(i).Selected = True
Checkboxlist1.Items(i).Attributes("style") = "background: url(http://renegadeox.com/img/on.png) no-repeat red; height:300px; color: blue; font-size:20px;"
End If
Next
Next
End If
End Sub
应用了背景颜色,但未应用图像。谢谢你的帮助。
答案 0 :(得分:1)
也许这会有所帮助。
Protected Sub Checkboxlist1_DataBound(sender As Object, e As EventArgs) Handles Checkboxlist1.DataBound
If test <> "" Then
Dim checklist As List(Of String) = ReturnListofStringClass.ReturnChecklistListOfString(test)
For i = 0 To Checkboxlist1.Items.Count - 1
For Each id As String In checklist
If Checkboxlist1.Items(i).Value = id Then
Dim t AS string= Checkboxlist1.Items(i).Text
Checkboxlist1.Items(i).Text = "<img src='http://renegadeox.com/img/on.png' style='width:10px; height:10px;' alt='' title='' />" & " " & t
End If
Next
Next
End If
End Sub
干杯