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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:19:56+00:00 2026-06-16T05:19:56+00:00

how to do show and hide div in javascript and simillarly in c# pageload

  • 0

how to do show and hide div in javascript and simillarly in c# pageload how to call div based on id value.can any one help on this ?

<ul>
<li><a href="#cat1">cat1</a></li>
<li><a href="#cat2">cat2</a></li>
<li><a href="#cat3">cat3</a></li>
</ul>

<div id="cat1">
<asp:UpdatePanel>
<asp:Panel>
<asp:ListView>
</asp:ListView>
</asp:Panel>
</asp:UpdatePanel>
</div>

<div id="cat2">
<asp:UpdatePanel>
<asp:Panel>
<asp:ListView>
</asp:ListView>
</asp:Panel>
</asp:UpdatePanel>
</div>

<div id="cat3">
<asp:UpdatePanel>
<asp:Panel>
<asp:ListView>
</asp:ListView>
</asp:Panel>
</asp:UpdatePanel>
</div>
  • 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-16T05:19:57+00:00Added an answer on June 16, 2026 at 5:19 am

    To reference the div in C# codebehind, you will need to add a runat="server" attribute to the div. You can then reference it by ID in the Page_Load method. You should also set ClientIDMode="Static" for the div, to fix the ID for the div so that you can reference it in Javascript. Beware of ID collisions for static IDs.

    Using strict Javascript, you can hide the div like this:

    var elem = document.getElementById('cat1');
    elem.style.display = 'none';
    

    And you can show the div like this:

    var elem = document.getElementById('cat1');
    elem.style.display = 'block';
    

    JQuery is probably a better way to go though than the getElementById approach:

    $('#cat1').hide();
    

    and

    $('#cat1').show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using this code to show/hide a div: <a href=# class=show_hide>Show/hide</a> <div class=slidingDiv> My
aspx script: <script type=text/javascript> $(document).ready(function() { $(.div_soru).hide(); $(.div_soru).first().show(); $(.onceki).click(function() { if ($(this).closest(.div_soru).prev(.div_soru).html() != null)
I am trying to show and hide a div based on a condition (for
I have a html structure like: <h3>Attributes (<a class=on_test href=#>show/hide all</a>)</h3> <div class=reference_tborder> <ul
I am using JQuery to hide/show a div depending on the selected value of
I'm trying to use JQuery to show/hide div tags based on the selected index
So I have this JavaScript I am working on, and I want to show/hide
I have a javascript function to show/hide a div on click and I would
I have the following jQuery <script type=text/javascript> jQuery(function(){ jQuery('.link1').click(function(){ jQuery('.hide-div').hide(); jQuery('.toggle1').show(); jQuery('#arrow').css({top: '0px'}); });
I am using the script below to show and hide a div based on

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.