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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:09:33+00:00 2026-05-12T07:09:33+00:00

Before I post my problem here, please be noted that i would really like

  • 0

Before I post my problem here, please be noted that i would really like to leave javascript and css for that menu as it is.

Now to my problem.
I have a menu in JavaScript that I am having a problem putting into asp.net page, I am having problem to produce the proper html to be more correct.

I would really appreciate if someone could point me to the right direction.

the menu in html looks like:

        <!-- HOME -->
        <div class="menu_item" onmouseover="hide_all_panels();">
            <a href="/default.aspx">Home</a>
        </div>


        <!-- ABOUT SITE -->
        <div id="trigger1" onmouseover="show_panel('0');">
            <div class="menu_item">

                <a href="/about_us.aspx">About Us</a>
            </div>
            <div class="hidden_div">
                <!-- ABOUT WEB SITE POPOUT -->
                <div class="menu" id="popout1">
                    <div class="menu_item">
                        <a href="/frequently_asked_questions.aspx">Frequently Asked Questions</a>
                    </div>

                    <div class="menu_item">
                        <a href="/our_team.aspx">Our Team</a>
                    </div>
                    <div class="menu_item">
                        <a href="/our_board.aspx">The Board</a>
                    </div>
                </div>
            </div>

        </div>

            <a href="/blog/">Blog</a>
        </div>


        <!-- CONTACT US -->
        <div class="menu_item" onmouseover="hide_all_panels();">
            <a href="/contact.aspx">Contact Us</a>
        </div>

as you can see, the divs are not symmetric for single menu that has not children I have simply link wraped into div, but for the menu with childrens I have a menu with one trigger div and 2 more somewhat main divs inside it.

I tryed to put something like that for this menu on asp.net side (don’t put atentions to link namings now, they are not important):

<asp:Repeater ID="rpt_Menu" runat="server" OnItemDataBound="rpt_Menu_DataBound">
                <ItemTemplate>

                    <asp:Panel ID="pnl_MainSubmenuDiv" runat="server" Visible="false" Enabled="false">
                        <div id="trigger<%= index %>" onmouseover="show_panel('<%= index %>');">
                    </asp:Panel>

                    <div class="menu_item" onmouseover="hide_all_panels();">
                        <a href="/default.aspx"><%# Eval("menu_name") %></a>
                    </div>

                    <asp:HiddenField ID="hdn_Id" runat="server" Value='<%# Eval("menu_id") %>' />
                    <asp:Repeater ID="rpt_SubMenu" runat="server">
                        <ItemTemplate>
                             <div class="menu" id="popout<%= index %>">
                               <div class="menu_item">
                                   <a href="/about_us.aspx"><%# Eval("menu_name") %></a>
                               </div>
                             </div>
                        </ItemTemplate>
                    </asp:Repeater>

                    <asp:Panel ID="pnl_MainSubmenuClose" runat="server" Visible="false" Enabled="false">
                        </div>
                    </asp:Panel>
                </ItemTemplate>
            </asp:Repeater>

and the code behind is very simple and there is nothing special, all i do is just bind second repeater that inside first repeater and make panels visible or invisible:

 protected void rpt_Menu_DataBound(object obj, RepeaterItemEventArgs e)
    {
        int parent_id = Int32.Parse(((HiddenField)e.Item.FindControl("hdn_Id")).Value.ToString());
        using (SamaraDataContext mycity = new SamaraDataContext())
        {
            var subMenu = from sm in mycity.tbl_menus
                          where (sm.menu_parent == parent_id)
                          select new
                          {
                              menu_id = sm.menu_id,
                              menu_name = sm.menu_name
                          };

            int count = 0;
            foreach (var item in subMenu)
            {
                count++;
            }

            if (count > 0)
            {
                ((Panel)e.Item.FindControl("pnl_MainSubmenuDiv")).Visible = true;
                ((Panel)e.Item.FindControl("pnl_MainSubmenuClose")).Visible = true;
                ((Repeater)e.Item.FindControl("rpt_SubMenu")).DataSource = subMenu.ToList();
                ((Repeater)e.Item.FindControl("rpt_SubMenu")).DataBind();
                this.index++;
            }
        }
    }
}

However my problems is that panels produce div’s even if they are hidden, which breaks out all the html structure.

I would really dislike to put the divs formating inside the code behind.

  • 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-12T07:09:33+00:00Added an answer on May 12, 2026 at 7:09 am

    To supplement blesh’s answer, use the PlaceHolder control instead of Panel. Placeholders do not render HTML surrounding the contents.

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

Sidebar

Ask A Question

Stats

  • Questions 172k
  • Answers 172k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I do not believe that anything like this currently exists.… May 12, 2026 at 2:29 pm
  • Editorial Team
    Editorial Team added an answer Set the LineHeight like before, but change the LineStackingStrategy to… May 12, 2026 at 2:29 pm
  • Editorial Team
    Editorial Team added an answer A little information in addition to Rob's the Wisconsin Program-Slicing… May 12, 2026 at 2:29 pm

Related Questions

I am learning OpenGL and just started getting into lighting. I enable lighting and
I have a problem running a simple Hello-world program in C++ on my Windows
I have a dataset obtained from MySQL that goes like this: Array ( [0]
Lets say I have an array of javascript objects, and I am trying to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.