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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:41:29+00:00 2026-05-13T10:41:29+00:00

I have a database query that returns an IList with 12 results in it.

  • 0

I have a database query that returns an IList with 12 results in it. Each result is a link and I would like to format my results so that I get 4 lists of 3 results side by side, kind of like this:

item1       item4       item7       item10
item2       item5       item8       item11
item3       item6       item9       item12

Also, I cannot just hard code it into an because the query results could range from 4 to 16. All I know is I want 4 columns and I want to co in ascending order filling in the first column, then the second, then the third, and finally the fourth.

  • 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-13T10:41:29+00:00Added an answer on May 13, 2026 at 10:41 am

    If you’re just looking for the HTML and CSS, try this:

    HTML

    <div class="ilist">
      <div class="column">
        <span class="item">item1</span>
        <span class="item">item2</span>
        <span class="item">item3</span>
        <span class="item">item4</span>
      </div>
      <div class="column">
        <span class="item">item5</span>
        <span class="item">item6</span>
        <span class="item">item7</span>
        <span class="item">item8</span>
      </div>
      <div class="column">
        <span class="item">item9</span>
        <span class="item">item10</span>
        <span class="item">item11</span>
        <span class="item">item12</span>
      </div>
      <div class="column">
        <span class="item">item13</span>
        <span class="item">item14</span>
        <span class="item">item15</span>
        <span class="item">item16</span>
      </div>
    </div>
    

    CSS

    .ilist {
      overflow-y:hidden;
    }
    .column {
      float:left;
      width:200px; /* You will want to specify
                      an appropriate width */
    }
    .column .item {
      display:block;
      height:1em;
    }
    

    Take note though that this won’t work in the event that any two items in a row (like item1 and item7) won’t have the same height.

    So this won’t work when you have/need something like this:

    item1       item4       item7       item10
                item4
    item2       item5       item8       item11
    item3       item6       item9       item12
    

    If you’re looking for C# you could try something like this:

    IList iList = /* ... */;
    using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter))
    {
     writer.AddAttribute(HtmlTextWriterAttribute.Class, "ilist");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     for(int i=0; i<iList.Count; i++) {
      writer.AddAttribute(HtmlTextWriterAttribute.Class, "column");
      writer.RenderBeginTag(HtmlTextWriterTag.Div);
      for (int j = i; j <= (i/4) && i<iList.Count; j++, i++)
      {
       writer.AddAttribute(HtmlTextWriterAttribute.Class, "item");
       writer.RenderBeginTag(HtmlTextWriterTag.Span);
       writer.WriteEncodedText(iList[i]);
       writer.RenderEndTag();
      }
      writer.RenderEndTag();
     }
     writer.RenderEndTag();
    
    }
    

    … you of course would need to still <link> to the CSS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get a LINQ-to-SQL query that returns only one item, not
I have a form that shows results from a database query, these results can
I have a very complex Linq to SQL query that returns a result set
What I have : A C# database query that returns two columns, one of
I have the following LINQ query that returns two objects from my database. These
I have a database query that returns ItemID, ItemName, CategoryID and CategoryName. I am
I have a tool that is setup to query our Clearquest Database to return
I have a Microsoft Access database query that I'm trying to import into a
I have the following query that runs in my Oracle database and I want
Possible Duplicate: SQL Server Database query help Hi, I have a problem that I

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.