有人可能知道我如何将图标附加到RadComobobox这里是我的代码:
我希望有人可以给我指导或工作的例子......谢谢
<telerik:RadComboBox ID="rcbJobType" runat="server" EmptyMessage="Select Job Type" Width="248px">
<Items>
<telerik:RadComboBoxItem Text="Select Job Type" Value="Select Job Type" />
<telerik:RadComboBoxItem Text="Long Term" Value="Long Term" />
<telerik:RadComboBoxItem Text="Short Term" Value="Short Term" />
<telerik:RadComboBoxItem Text="Last Minute" Value="Last Minute" />
</Items>
</telerik:RadComboBox>
occurs on pageload
Protected Sub IconAttached()
Dim imgDir As New DirectoryInfo(Server.MapPath(Globals.gRootRelativeSecureURL("/Images/Layout/offDuty.png")))
For Each file As FileInfo In imgDir.GetFiles("*.png")
Dim item As New RadComboBoxItem(file.Name.Replace(".png", ""))
item.ImageUrl = "Img/" + file.Name
rcbEditJobType.Items.Add(item)
Next
= "<img src='" + Globals.gRootRelativeSecureURL("/Images/Layout/offDuty.png") + "' border=""0"" align=""absmiddle"">"
End Sub
答案 0 :(得分:0)
请尝试使用以下代码段。
<强> ASPX 强>
<telerik:RadComboBox runat="server" ID="RadComboBox1">
<Items>
<telerik:RadComboBoxItem Text="Select Job Type" Value="Select Job Type" />
<telerik:RadComboBoxItem Text="Long Term" Value="Long Term" />
<telerik:RadComboBoxItem Text="Short Term" Value="Short Term" />
<telerik:RadComboBoxItem Text="Last Minute" Value="Last Minute" />
</Items>
<ItemTemplate>
<div>
<asp:Image ID="Image1" runat="server">
<asp:Label ID="Label1" Text='<%# Eval("Text") %>' runat="server">
</div>
</ItemTemplate>
</telerik:RadComboBox>
<强> ASPX.VB 强>
For Each item As RadComboBoxItem In RadComboBox1.Items
Dim Image1 As Image = DirectCast(item.FindControl("Image1"), CheckBox)
Image1.ImageUrl = "Please add image url here"
Next