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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:14:28+00:00 2026-06-04T02:14:28+00:00

I have a asp:Content tag added to my aspx page. <asp:Content ID=Step1Content ContentPlaceHolderID=MainContent Runat=Server>

  • 0

I have a asp:Content tag added to my aspx page.

<asp:Content ID="Step1Content" ContentPlaceHolderID="MainContent" Runat="Server">

and I have a javascript like below,

   function switchAllMenu() {
            var ids = new Array('divOut', 'divQOR', 'divPop', 'divRD', 'divCst', 'divRep', 'divCnt');
            var i, el, newObj, el1;
            if (document.getElementById('aSwitchAllMenu').value == "Expand All") {
                document.getElementById('aSwitchAllMenu').value = "Collapse All";
                for (i = 0; i < ids.length; i++) {
                    el = document.getElementById(ids[i]);
                    newObj = ids[i].replace("div", "li");
                    el1 = document.getElementById(newObj);
                    el.style.display = '';
                    el1.className = 'active';
                }
            }
            else {
                document.getElementById('aSwitchAllMenu').value = "Expand All";
                for (i = 0; i < ids.length; i++) {
                    el = document.getElementById(ids[i]);
                    newObj = ids[i].replace("div", "li");
                    el1 = document.getElementById(newObj);
                    el.style.display = 'none';
                    el1.className = '';
                }

when i click the expandAll or collapseall the corresponding Div has to expand and collapse. But since the content place holder is added to the page, it prefixes to the field names and my JavaScript wouldnt work. what change i should make in this javascript so my expand collapse works.

My field names looks like this, MainContent_divOut, MainContent_divQOR…should i chnge the var id’s with “MainContent_” as prefix. However even that didnt work excpet for the 1st field ‘divOut’.

  • 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-06-04T02:14:31+00:00Added an answer on June 4, 2026 at 2:14 am

    You can fix that in the web.config depending on your asp.net version,
    if you are using 4.0, you can set it inline ,
    <asp:TextBox runat="server" ClientIDMode="static" id="txt1" />

    this will prevent the prefix to be added to your control id.

    more detail here

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

Sidebar

Related Questions

I have my asp.net sub-master page setup like this: <asp:Content ID=MainContent runat=server ContentPlaceHolderID=mainContent> <!doctype
I have the following ASP page: <asp:Content ID=Content2 ContentPlaceHolderID=ShellContent runat=server> <form runat=server id=AddNewNoteForm method=post>
I have following view <asp:Content ID=Content2 ContentPlaceHolderID=MainContent runat=server> <h2>Tables <%=ViewData[RetriverName] %></h2> <%using (Html.BeginForm(ResfreshSelectedTables, Home))
I have the following code in the front end <asp:Content ID=Content1 ContentPlaceHolderID=cphMain runat=server> <script
I have a CheckBox on an ASP.NET Content Form like so: <asp:CheckBox runat=server ID=chkTest
I have a tag element in .aspx page: <a id=loginLink runat=server class=loginLink href=# onclick=$('registerform').hide();
I have an ASP page with the following repeater: <asp:Repeater runat=server ID=RegionRepeater DataSourceID=SqlDataSourceRegions EnableViewState=true>
I have an ASP.NET content page. The HTML tag associated with the content page
In VS 2008, I have an ASP.NET content page having one master page. I
I have an asp:FormView with an ItemTemplate. I'd like to design the content within

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.