jeudi 10 avril 2014

c# - icône attaché à radcomobox - Stack Overflow


Does someone might know how can I attached icon to RadComobobox here is my code:


I hope that someone can give me direction or example that working....thanks


<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



Please try with the below code snippet.


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


Does someone might know how can I attached icon to RadComobobox here is my code:


I hope that someone can give me direction or example that working....thanks


<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


Please try with the below code snippet.


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

0 commentaires:

Enregistrer un commentaire