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

  • Home
  • SEARCH
  • 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 4097604
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:11:41+00:00 2026-05-20T20:11:41+00:00

I have stored my tags in the SQL Server database, TABLE NAME: Tags COLUMNS

  • 0

I have stored my tags in the SQL Server database,
TABLE NAME: Tags
COLUMNS

  • TagID
  • TagName
  • TagURL

Now I want to create a list like below in the aspx page, created from the database. I have done the work of keeping all the tags and tagURL from the database in a dataset. But I have no idea how to create dynamic HTML list or asp.net list from database.

I have to create list like this:

<ul>
            <li class="tag1"><a href="#">Lorem ipsum</a></li> 
            <li class="tag2"><a href="#">Dolor sit amet</a></li>

            <li class="tag3"><a href="#">Consectetur adipiscing elit</a></li>
            <li class="tag2"><a href="#">Proin </a></li>
            <li class="tag4"><a href="#">Sagittis libero</a></li>
            <li class="tag1"><a href="#">Aliquet augue</a></li>
            <li class="tag1"><a href="#">Quisque dui lacus</a></li>
            <li class="tag5"><a href="#">Consequat</a></li>

            <li class="tag2"><a href="#">Dictum non</a></li>
            <li class="tag1"><a href="#">Venenatis et tortor</a></li>
            <li class="tag3"><a href="#">Suspendisse mauris</a></li>
            <li class="tag4"><a href="#">In accumsan </a></li>
            <li class="tag1"><a href="#">Egestas neque</a></li>
            <li class="tag5"><a href="#">Mauris eget felis</a></li>

            <li class="tag1"><a href="#">Suspendisse</a></li>
            <li class="tag2"><a href="#">condimentum eleifend nulla</a></li>
        </ul>

Where

>  class="tag <random number from 1-5>"
  • 1 1 Answer
  • 0 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-20T20:11:42+00:00Added an answer on May 20, 2026 at 8:11 pm

    You will probably want to use something like an asp.net repeater. Here is an example from the msdn library while I write up a more suitable one.

    Digging Into the Repeater

    This is my understanding of your requirements. I’m not sure if the random number generation could be handled better.

     <asp:Repeater ID="Repeater1" runat="server">
        <HeaderTemplate>
            <ul>
        </HeaderTemplate>
        <ItemTemplate>
            <li class="<%# String.format("tag{0}", GetRandom())%>"><a href="<%# Eval("TagUrl") %>"><%# Eval("TagName")%></a></li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
    

    Code Behind

    Private _random As Random
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
        If Not IsPostBack Then
    
            _random = New Random
    
            Dim dt As New DataTable
            dt.Columns.Add("TagName")
            dt.Columns.Add("TagUrl")
    
    
            dt.Rows.Add("Test1", "TestUrl1")
            dt.Rows.Add("Test2", "TestUrl2")
            dt.Rows.Add("Test3", "TestUrl3")
            dt.Rows.Add("Test4", "TestUrl4")
            dt.Rows.Add("Test5", "TestUrl5")
    
            Repeater1.DataSource = dt
            Repeater1.DataBind()
    
        End If
    
    
    End Sub
    
    Protected Function GetRandom() As Integer
        Return _random.Next(1, 5)
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have snippets of Html stored in a table. Not entire pages, no tags
I have stored procedures in SQL Server T-SQL that are called from .NET within
I have a stored procedure in SQL 2005. The Stored Procedure is actually creating
I've got data in SQL Server 2005 that contains HTML tags and I'd like
I have some 'spaghetti'-style code that is generously saused with Custom tags and Stored
I have connected my C# winforms app to SQL Server 2005 where is a
I have an array of tags taken from a MySQL database. Obviously, these tags
I have a large quantity of partial HTML stored in a CMS database. I'm
I have the following content stored inside a database column: <p>Lorem ipsum dolor sit
I have a handful of raw SQL queries for SQL Server which use SCOPE_IDENTITY

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.