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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:18:57+00:00 2026-05-26T02:18:57+00:00

I want to render datalist to divs instead of table and the repeat columns

  • 0

I want to render datalist to divs instead of table and the repeat columns will fixed by float style on div.

So any one knows an override render method to do that.

Thanks.

  • 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-26T02:18:58+00:00Added an answer on May 26, 2026 at 2:18 am

    I found this solution but I posted it to help others;

    Some users suggest to use repeater and that is right, but for that case to replace div instead of table in datalist

    RepeatLayout=RepeatLayout.Flow 
    

    This will make it span with br.
    But using Horizontal for RepeatDirection wil remove br but still items rendered with span.

    RepeatDirection=RepeatDirection.Horizontal 
    

    This statement will remove br but still items rendered with span.

    So override RenderContents to create your own divs outside span and remove br if you do not want to use Horizontal RepeatDirection, as follow:

    protected override void RenderContents(HtmlTextWriter w)
    {
        writer.WriteBeginTag("div");
        writer.WriteAttribute("id", this.ClientID);
        writer.WriteAttribute("class", cssClass);
        writer.Write(HtmlTextWriter.TagRightChar);
        foreach (DataListItem li in this.Items)
        {
            writer.WriteBeginTag("div");
            writer.WriteAttribute("id", li.ClientID);
            writer.WriteAttribute("class", li.CssClass);
            writer.Write(HtmlTextWriter.TagRightChar);
            li.CssClass = null; // clear css not to added in span
            li.RenderControl(w);
            writer.WriteEndTag("div");
        }
        writer.WriteEndTag("div");
    
    }
    

    My Regards

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

Sidebar

Related Questions

I want to render something like this in firefox <div style=float:left> Row1,Column1 </div> <div>
i want to render one of these sets of views: head body-$id1 foot OR
I want to render same template on one page which should display the value
I want to render multiple partials in a controller, these will not be part
I want to render my scene in one thread and then blit the result
I want to render a graph in similar layout to the following one: I
I want to render a table which holds all entity data. There should be
We have a web control that we want to render into a div on
I want to render the partial view using ajax. When I submit the button,
I want to render a profile user container that contains a list of labels

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.