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

The Archive Base Latest Questions

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

On the aspx: <table> <tr> <asp:Repeater ID=rptHeader runat=server> <ItemTemplate> <th><%#Eval(Category)%></th> </ItemTemplate> </asp:Repeater> </tr> <tr>

  • 0

On the aspx:

<table>
<tr>
<asp:Repeater ID="rptHeader" runat="server">
    <ItemTemplate>
        <th><%#Eval("Category")%></th>
    </ItemTemplate>
</asp:Repeater>
</tr>
<tr>
<asp:Repeater ID="rptContents" runat="server">
    <ItemTemplate>
        <td valign="top">
            <%#Eval("Content")%>
        </td>
    </ItemTemplate>
</asp:Repeater>
</tr>
</table>

On the code-behind:

protected void Page_Load(object sender, EventArgs e) 
{
    rptHeader.DataSource = DataSource;
    rptHeader.DataBind();
    rptContentBlocks.DataSource = DataSource;
    rptContentBlocks.DataBind();
}

The problem here is that instead of using Two repeaters, can we use only one?
We actually need the header to be separated from the contents using a different table row…

Edit: changed rptHeader’s ItemTemplate’s html element from <td> to <th> to be a little clearer. 🙂

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

    IMO it’s impossible without repeater hacking. Anyway, there is a rather irregular approach that maybe works. Also you can use two foreach statements instead of repeaters.

    Code

    protected string[] headers = { "A", "B", "C", "D" };
    protected string[] contents = { "Alpha", "Beta", "Counter", "Door" };
    
    //string[] headers = { "A", "B", "C", "D" };
    //string[] contents = { "Alpha", "Beta", "Counter", "Door" };
    
    //DataList1.RepeatColumns = headers.Length;
    //DataList1.DataSource = headers.Concat(contents);
    //DataList1.DataBind();
    

    Html markup

    <table>
        <tr>
            <%foreach (string item in headers)
              { %>
              <th><%= item %></th>
            <% } %>
        </tr>
        <tr>
            <%foreach (string item in contents)
              { %>
              <td><%= item %></td>
            <% } %>
        </tr>
    </table>
    <!--
        <asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal">
            <ItemTemplate>
                <%# Container.DataItem %>
            </ItemTemplate>
        </asp:DataList>
    -->
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

aspx file: <asp:Repeater ID=Repeater_sorular runat=server> <HeaderTemplate> </HeaderTemplate> <ItemTemplate> <div class=div_soru> <div class=div_soru_wrapper> <%#Eval(Subject)%> <asp:RadioButtonList
//code in aspx. </asp:TemplateField> : : : <ItemTemplate> <asp:DropDownList ID=didDdl runat=server DataSourceID=departmentsDataSource DataTextField=Department DataValueField=DepartmentID
<asp:Repeater ID=repFilter runat=server> <HeaderTemplate> <div id=posting align=center> </HeaderTemplate> <ItemTemplate> <div class=friends_area id=record-> <%# ((Alert)Container.DataItem).Message
Here's a my Default.aspx page (with unnecessary details excised): <asp:Content ID=Content1 ContentPlaceHolderID=ContentPlaceHolder1 Runat=Server> <div
I have a DIV inside my repeater as follows: <asp:Repeater ID=topicView runat=server OnItemCommand=Delete_ItemCommand> <ItemTemplate>
I'm trying to create cascading DDLs. My aspx page: <form id=form1 runat=server> <table> <tr>
I have a aspx page that looks something like this: <table runat=server id=tblTEst> <tr
I'm building a html table dynamically in an ASP.NET code behind file using C#.
Please see the below code: I am have a table row defined using asp.net
I've an asp repeater which has some fields inside an ItemTemplate. Each item in

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.