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 3494378
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:59:56+00:00 2026-05-18T11:59:56+00:00

I was interested to know whether or not asp.net is allows us to dynamically

  • 0

I was interested to know whether or not asp.net is allows us to dynamically generate HTML inline on the .aspx Source page (not the code-behind).

For testing I created the following simple .aspx page…

In my asp.net code-behind I have the following:

    protected List<string> myList = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (myList == null)
            myList = new List<string>();

        myList.Add("One String");
        myList.Add("Two String");
        myList.Add("Three String");
        myList.Add("Four String");

        this.Repeater1.DataSource = myList;
        this.Repeater1.DataBind();
    }

On the corresponding Source page I have:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <ol>
        <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <li>
                    <%# DataBinder.GetDataItem(myList) %>
                </li>
            </ItemTemplate>
        </asp:Repeater>
    </ol>
</body>
</html>

The resultant .aspx page is:

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title></head>
<body>
    <ol>

                <li></li>

                <li></li>

                <li></li>

                <li></li>

    </ol>
</body>
</html>

Notice that the Repeater control did in fact create the four list items. However, the contents (One String, Two String, etc) of the myList list did not come along for the ride.

What do I need to do to evaluate the myList list and get its values inside the list item tags? By the way, I’m not concerned with how to use the Repeater control specifically, so if there is a solution to this problem that does not include the Repeater control, I’m fine with that.

Note: I’m aware that I can bind the “myList” generic list to an asp:BulletedList and get the same result. I am more interested in dynamically creating HTML inline of the Source page.

  • 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-18T11:59:57+00:00Added an answer on May 18, 2026 at 11:59 am

    Use this code:

    <asp:Repeater ID="Repeater1" runat="server">
        <ItemTemplate>
             <li>
                <%# Container.DataItem %>
             </li>
        </ItemTemplate>
    </asp:Repeater>
    

    If you need to bind source with list of objects with properties, try to use:

    <asp:Repeater ID="Repeater1" runat="server">
        <ItemTemplate>
             <li>
                <%# Eval("PropertyName") %>
                or
                <%# Eval("PropertyName","DataFormat") %>
             </li>
        </ItemTemplate>
    </asp:Repeater>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am interested to know whether anyone has written an application that takes advantage
I am interested to know what strategies people have to keep their code AND
I would like to know whether it is possible to write code that would
As the question states, I would mainly like to know whether or not my
I'd be interested to know whether there are programming languages which have shorthand equality
From the discussion started here , I'd like to know whether the following code
I'm interested to know if there's any sites out there that has implemented CardSpace
I'm interested to know what approach people are taking in developing automated unit tests
I am interested to know how the DNS requests to political sites differ in
Question: I'm interested to know the best practice for killing a long standing operation

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.