• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Asp.net bulletlist with graphics

Hi Experts

I have a bullet list in asp.net which is data bound, the list is a a user guide, what I want to do is show the list but include a graphic (graphic to be at the end of the text not the actual bullet itself), I have the image name in the db, does anyone know of a control that can do this?
0
MrDavidThorn
Asked:
MrDavidThorn
  • 2
1 Solution
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Hi, I did this example for you, try it:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Test data...
            DataTable dtt = new DataTable();
            dtt.Columns.Add("MyText", typeof(string));
            dtt.Columns.Add("MyImage", typeof(string));
            dtt.Rows.Add("My record 1", "Graphic1.gif");
            dtt.Rows.Add("My record 2", "Graphic2.gif");
            dtt.Rows.Add("My record 3", "Graphic1.gif");
            Repeater1.DataSource = dtt;
            Repeater1.DataBind();
        }
    }

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Repeater ID="Repeater1" runat="server">
        <HeaderTemplate>
            <ul>
        </HeaderTemplate>
        <ItemTemplate>
            <li>
                <%# Server.HtmlEncode(Eval("MyText").ToString()) %>
                <img src="/Images/<%# Eval("MyImage") %>" alt="" />
            </li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
    </form>
</body>
</html>

Open in new window


You can download the aspx file from this link:
http://dl.dropbox.com/u/13237304/EE/RepeaterExample.zip

You got the idea?
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
The namespace System.Data.OleDb in the example is not required:
<%@ Import Namespace="System.Data.OleDb" %>

Open in new window

Copy/Paste error :p
0
 
MrDavidThornAuthor Commented:
thanks dude
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now