SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Show image according to value from database

    I want to show image in following ListView control according to value from database.

    For example:
    If value = 1 than show "edit.gif" else show "details.gif"


    HTML Code:
      <table>
        <asp:ListView ID="ListView1" runat="server" EnableViewState="False">
            <ItemTemplate>
                <tr>
                    <td align="center"><asp:ImageButton ID="btnEdit" runat="server" ImageUrl="~/edit.gif" /></td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
      </table>

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,880
    Mentioned
    48 Post(s)
    Tagged
    0 Thread(s)
    You should be able to do something like this:

    <% RepeaterItem.DataItem["column"] == "1" ? "edit.gif" : "details.gif" %> in the ImageUrl attribute


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •