0

I want to display company name and logo in dropdownlist.I have fetch all the company name in dropdownlist but i am not able to add logo with name.

I have xml file where company name and images are specified. Structure of xml file:

 <ente>
    <nazione>ALBANIA</nazione>
    <name>Tirana</name>
    <img>tvsh-albania.png</img>
    <descri>TVSH - Rruga Ismail Quemali 11, Tirana</descri>
    <latitudine>41.321102</latitudine>
    <longitudine>19.823112</longitudine>
    <zoom>-4</zoom>
  </ente>

I have all images in image folder also.

I have use this code:

 Protected Sub BindDataToGridviewDropdownlist()
        Dim xmlreader As New XmlTextReader(Server.MapPath("XMLFILE.xml"))
        Dim ds As New DataSet()
        ds.ReadXml(xmlreader)
        xmlreader.Close()

            If ds.Tables.Count <> 0 Then

                ddlDetails.DataSource = ds

            ddlDetails.DataTextField = "nome"
            ddlDetails.DataValueField = "nome"
            ddlDetails.DataBind()
            End If
    End Sub

What i need to do so i can also display image with company name.

4

3 回答 3

0

我认为在 html 和 .net 中很难实现,但使用 jQuery 插件应该更容易,例如这个

于 2013-08-09T08:27:56.240 回答
0

尝试使用 jQuery http://www.htmldrive.net/items/show/749/Image-Select-Elements-with-jQuery-and-CSS3.html

或者试试这个 http://designwithpc.com/Plugins/ddSlick

在示例 2.. HTML 需要看起来像这样

 <select id="demo-htmlselect">
        <option value="0" data-imagesrc="http://dl.dropbox.com/u/40036711/Images/facebook-icon-32.png"
            data-description="Description with Facebook">Facebook</option>
        <option value="1" data-imagesrc="http://dl.dropbox.com/u/40036711/Images/twitter-icon-32.png"
            data-description="Description with Twitter">Twitter</option>
        <option value="2" selected="selected" data-imagesrc="http://dl.dropbox.com/u/40036711/Images/linkedin-icon-32.png"
            data-description="Description with LinkedIn">LinkedIn</option>
        <option value="3" data-imagesrc="http://dl.dropbox.com/u/40036711/Images/foursquare-icon-32.png"
            data-description="Description with Foursquare">Foursquare</option>
    </select>

您可以通过绑定到转发器从 Code Behind 创建该 HTML

<asp:Repeater id="rp" runat="server">
    <HeaderTemplate>
        <select id="demo-htmlselect">
    </HeaderTemplate>

    <ItemTemplate>
        <option value='<%#Container.DataItem("name")%>' data-imagesrc='<%#Container.DataItem("img")%>'
            data-description='<%#Container.DataItem("descri")%>'>
                <%#Container.DataItem("name")%>
        </option>
    </ItemTemplate>

    <FooterTemplate>
    </select>
    </FooterTemplate>
</asp:Repeater>
于 2013-08-09T08:40:08.680 回答
0

开箱即用的下拉列表不支持添加图片。寻找第 3 方组件。

于 2013-08-09T08:24:22.240 回答