Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 277529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:05:32+00:00 2026-05-12T01:05:32+00:00

I am just a beginner in ASP.NET. My question is simple, I wanna add

  • 0

I am just a beginner in ASP.NET. My question is simple, I wanna add list items dynamically from the code behind file and I want each item to have a text and couple of images as hyperlinks. The HTML sample should be like,

<ul>
  <li>do foo &nbsp;<a href="#"><img src="some_image.png" /></a></li>
  <li>do bar &nbsp;<a href="#"><img src="some_image.png" /></a></li>
  ...
</ul>

The number of items is dependent on the collection retrieved by the code behind file.

P.S. my code behind file is written in C#

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T01:05:32+00:00Added an answer on May 12, 2026 at 1:05 am

    The Repeater control is the simplest way to create a customized bulleted list, plus it gives you complete control over the HTML you generate. To use it, set up a template like this:

    <ul>
    <asp:Repeater runat="server" ID="ListRepeater">
       <ItemTemplate>
           <li>do foo &nbsp;<a href='#'><img src='<%# Eval("ImageSource") %>' /></a></li>
       </ItemTemplate>
    </asp:Repeater>
    </ul>
    

    Then in your code-behind (or declaratively in your markup, depending on your preference), set the repeater’s data source and bind it:

    void Page_Load(object sender, EventArgs e) {
      // Some method you've defined to get your images
      List<string> imageList  = GetImages();
      ListRepeater.DataSource = imageList;
      ListRepeater.DataBind();
    }
    

    ASP.NET renders the template once for each item in your data source.

    The Repeater control has more features than what I’ve shown here, but this should get you started. Good luck!


    Edit: a year after writing this answer, I still think repeaters are the best option among server controls, but more and more I prefer foreach statements right in my .aspx templates:

    <ul>
        <% foreach(Image image in this.Images) { %>
            <li>do foo &nbsp;<a href='#'><img src='<%= image.Source %>' /></a></li>
        <% } %>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam just a beginner student socket programming.I tried a simple code from TCP/IP Sockets
I'm an absolute beginner with ASP.NET[MVC] so this is probably a dumb question. I
I'm just playing with some linq and asp.net - absolute beginner so I'm not
i'm kind of an asp.net beginner and i'm trying just to set the visible
I'm just a beginner about ASP.NET MVC. Thought it doesn't have any problems in
I am just a beginner of ASP.NET MVC. I have done some page by
another beginner problem. Why isn't the following code with an asp.net page not working?
Another beginner question for ASP.NET: I'm starting an ASP.NET project in Visual Studio 2008,
I am wanting to learn ASP.Net and am just a beginner. I have done
I am beginner in jQuery and asp.net. I created a simple chat application using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.