collapse all and expand all using bootstrap and jquery

Hi All,

I need to display set of comments from Database in one of my web forms.
I need to display the comment on the click of down arrow. Once the comment is shown the arrow should be changed to up arrow. Clicking the up arrow will hide the comment and changes itself to down arrow.

I need to do this dynamically in C# and because the comments, username and entrytime are retrieved from database into datatable. so for every row in the datatable I need to create a div with its inner html set for above effect. I also need to have expand all and collapse all links where the first will show all comments and collapse all will hide all comments.

using bootstrap I tried doing some of it in jsfiddle. The link is here. 

I have no clue how to do expand all and collapse all. Your help is appreciated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
This should do what you want
<!doctype html>
<link href="css/bootstrap.css" rel="stylesheet" />
<style type="text/css">
h4 a:after {
    font-family:'Glyphicons Halflings';
    float: right;
    color: grey;
h4 a.collapsed:after {
  <div class="container">
    <div class="row">
      <div class="col-lg-6">
        <h4><a data-parent="form-accordian" data-toggle="collapse" class="collapsed" href="#demo">user abc added a comment - 18/May/15 1:54 PM</a></h4>
        <div class="collapse in" id="demo"> These comments are loaded from the database and hence should be created dynamically</div>      
        <h4><a data-parent="form-accordian" data-toggle="collapse" class="collapsed" href="#demo1">user xyz added a comment -8/april/15 1:54 PM </a></h4>
        <div class="collapse" id="demo1"> This needs to be multiline comment that will be around 4to 5 sentences long. This shoould be shown only when the collapse down arrow is clicked and the collapse down arrown should change to collapse-up. when collapse -up is clicked The comment should hide and collapsible up should be changed to collapsible down</div>        
<script src=""></script>

<!-- Latest compiled and minified JavaScript -->
<script src="js/bootstrap.js"></script>
<script type="text/javascript">

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JyozealAuthor Commented:
Thanks for the answer. This is what I am looking for.
Julian HansenCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.