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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:54:45+00:00 2026-05-22T19:54:45+00:00

I have a div inside an asp:Repeater: <ItemTemplate> <div id=myDiv style=display:none /> </ItemTemplate> </asp:Repeater>

  • 0

I have a div inside an asp:Repeater:

   <ItemTemplate>
          <div id="myDiv" style="display:none" />
   </ItemTemplate>
</asp:Repeater>

<script type="text/javascript">
    window.onload = function() {
          document.getElementById('myDiv').style.display = 'block';
</script>

This works great except my div elements occur within a repeater which means only the first div is found. Could some please explain to me how to get all the divs in the ItemTemplate?

  • 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-22T19:54:46+00:00Added an answer on May 22, 2026 at 7:54 pm

    It is invalid to use the same id more than once on a page. Instead you’ll have to use some other means of finding your elements, such as css class. jQuery makes this task easy.

    $(".someClass").show();
    

    However, you may not even need to do that. If all you are trying to do is change some styles on a set of elements under a common parent, you can just change the class name of the parent. Consider the following repeater:

    <div id="repeaterParent">
        <asp:Repeater runat="server">
            <ItemTemplate>
                <div class="repeaterItemDiv"></div>
            </ItemTemplate>
        </asp:Repeater>
    </div>
    

    Set up your css like this:

    #repeaterParent .repeaterItemDiv
    {
        display: none;
    }
    #repeaterParent.showDivs .repeaterItemDiv
    {
        display: block;
    }
    

    Then use this JavaScript:

    document.getElementById("repeaterParent").className = "showDivs";
    

    Or, this jQuery:

    $("#repeaterItemParent").addClass("showDivs");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In asp.net website, inside .aspx i have following code <script type=text/javascript> function callme(option) {
I have a div[class=container] and inside is div[class=item] like: <style type=text/css> .container{ height:50vh; width:
I have an ASP.NET repeater, which contains 3 divs inside the ItemTemplate. Each div,
I have 2 Repeaters one inside another. <div id=result> <asp:Repeater runat=server id=results> <Itemtemplate> <asp:Button
I have the following input inside an asp.net repeater <div class=detailsItem> <input type=button class=saveCommand
I have a DIV inside my repeater as follows: <asp:Repeater ID=topicView runat=server OnItemCommand=Delete_ItemCommand> <ItemTemplate>
I have the following html (inside ASP.NET Repeater): <div class=team_member> <a class=teamMemberLink href='<%# Profile.aspx?uID=
I have a div inside a repeater (ItemTemplate) with the following markup <div class="bottle
I have this div inside a repeater, where i set the class, onmouseover and
<asp:Repeater ID=repFilter runat=server> <HeaderTemplate> <div id=posting align=center> </HeaderTemplate> <ItemTemplate> <div class=friends_area id=record-> <%# ((Alert)Container.DataItem).Message

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.