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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:15:55+00:00 2026-05-16T12:15:55+00:00

Given the following HTML: <asp:content id=Content1 contentplaceholderid=mainContent runat=server> <div class=scrollRow> <table width=100%> <tr> <td

  • 0

Given the following HTML:

<asp:content id="Content1" contentplaceholderid="mainContent" runat="server">

<div class="scrollRow">
    <table width="100%">
        <tr>
            <td width="25%">Site name: <b>My site</b></td>
            <td>Created on 12th Aug 2010</td>
            <td align="right"><button onclick="doRevert(1)">Revert to this</button></td>
        </tr>
    </table>
</div>

<div class="scrollRow">
    <table width="100%">
        <tr>
            <td width="25%">Site name: <b>Another site</b></td>
            <td>Created on 3rd Aug 2010</td>
            <td align="right"><button onclick="doRevert(1)">Revert to this</button></td>
        </tr>
    </table>
</div>

<div class="scrollRow scrollRowOn">
    <table width="100%">
        <tr>
            <td width="25%">Site name: <b>Another site</b></td>
            <td>Created on 3rd Aug 2010</td>
            <td align="right"></td>
        </tr>
    </table>
</div>

</asp:content>

Which is a list of rows, how am I programatically meant to generate these after I have retrieved the SQL rows from the code behind? Do I need to make my own control, or something along those lines?

  • 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-16T12:15:55+00:00Added an answer on May 16, 2026 at 12:15 pm

    Try something along these lines:

        <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_OnItemDataBound">
        <ItemTemplate>
            <div class='<%# SetClass(Eval("SiteId")) %>'>
                <table width="100%">
                  <tr>
                       <td width="25%">Site name: <b><%# Eval("SiteName") %></b></td>
                       <td>Created on <%# DataBinder.Eval(Container.DataItem, "CreateDate", "{0:dd MMM yyyy}")%></td>
                        <td align="right"><button id="btnRevert" runat="server" onclick="doRevert(1)">Revert to this</button></td>
                </tr>
                </table>
              </div>
            </ItemTemplate>
       </asp:Repeater>
    

    In the codebehind Repeater1_OnItemDataBound event you could set the button to be visible or not, depending on whether the item is the current one.

        protected void Repeater1_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RepeaterItem item = e.Item;
            if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item)
            {
                Site site = e.Item.DataItem as Site; //List<Site> is what you are binding to the repeater
                if (site.SiteId == currentSiteId)
                {
                    var btn = e.Item.FindControl("btnRevert") as Button;
                    if (btn != null)
                    {
                        btn.Visible = false;
                    }
                }
            }
        } 
    

    CSS Classes for your items can be set like this:

        protected string SetClass(object obj) {
            int siteId;
            if (int.TryParse(obj.ToString(), out siteId)){
                if (siteId == currentSiteId) //currentSiteId determined elsewhere
                {
                    return "scrollRow";
                }
            }
            return "scrollRow scrollRowOn";
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following html: <tr> <td>Content</td> <td>Content</td> <td>Content</td> <td><img id=imgProductPurchased runat=server visible=true alt=Product Purchased
Given the following HTML: <div class=foo>howdy howdy howdy how</div> <div class=bar>Hello</div>​ and the following
Given the following html table, I would like to control the width of the
Given the following HTML <div style=width: 500px; height: 500px; border: 1px solid red;> <div
Given the following HTML structure: <div class=wrapper> <div class=top> <a href=http://example.com class=link>click here</a> </div>
Given the following HTML: <div class=required>required only</div> <div class=note>note only</div> <div class=required note>required and
Given the following html table and script shown below I am having a problem
Given the following HTML <div classmyclass>10</div> <div classmyclass>25</div> <div classmyclass>50</div> <div classmyclass>20</div> I want
Given the following HTML example... <div id='div1'>div one</div> <div id='div2'>div two</div> ...I found that
I have the following GridView in ASP.NET 3.5: <asp:GridView ID=gvTable runat=server AllowSorting=true ShowHeader=true> <Columns>

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.