【发布时间】:2018-07-30 21:27:07
【问题描述】:
请看一下屏幕截图,其中 GB 标志显示为 css 测试范围,下拉列表显示没有标志图像的国家列表,我需要显示标志图像!
<span class="flag-icon flag-icon-gb"></span>
<div class="col-xs-12 col-sm-5 pl0">
<asp:DropDownList CssClass="form-control thintext" ID="lstCountryLivingIn" runat="server" ClientIDMode="Static">
<asp:ListItem Text="Please Select..." Value=""></asp:ListItem>
</asp:DropDownList>
</div>
代码隐藏
If ds.Tables(0).Rows.Count > 0 Then
For i = 0 To ds.Tables(0).Rows.Count - 1
Dim li As New ListItem()
li.Value = ds.Tables(0).Rows(i)("CountryId").ToString
li.Text = ds.Tables(0).Rows(i)("CountryTitle").ToString & " ( " & ds.Tables(0).Rows(i)("CountryPhoneCode").ToString & " )"
‘ I need to add some css / style or attribute here to show country flags
lstCountryLivingIn.Items.Add(li)
Next
我需要在代码隐藏中使用 css / 样式来在每个下拉项目中显示国家/地区标志,但我不确定如何使用???
我在国家表中有 2 个字符的 ISO 国家代码,例如“gb”,并且我有所有 svg 格式的标志
进一步参考: http://www.aspdotnet-pools.com/2014/09/dropdownlist-item-with-custom-icon.html
【问题讨论】: