Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Resize tr when inner div is hidden

Posted on 2014-02-11
5
290 Views
Last Modified: 2014-02-11
Hi Experts,

I have a gridview inside a <div> inside a <tr> tag. I want the gridview to be hidden or displayed on mouseover, but I want the row to expand and contract as needed.

Currently, I have the following html and js, but it's not working. Can you help?

<tr id="trStatus">
                            <td class="auto-style3">Status</td>
                            <td class="auto-style3">
                                <div onmouseover="showStatusDetails()" onmouseout="hideStatusDetails()"><u><asp:Label ID="lbStatus" runat="server" Text="Status"></asp:Label></u></div>
                                <div id="divStatusDetails">
                                    <asp:GridView ID="gvStatus" runat="server" DataSourceID="sqlDSoStatus" GridLines="Horizontal">
                                         <Columns>
                                            <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
                                           </Columns>
                                    </asp:GridView>
                                </div>
</td></tr>
                            <script type="text/javascript">
                                
                                var divDetails = document.getElementById("divStatusDetails");

                                function hideStatusDetails() {

                                    divDetails.style.visibility = "hidden";
                                    trStatus.style.height = "30px";
                                }
                                

                                function showStatusDetails() {

                                    divDetails.style.visibility = "visible";
                                    trStatus.clientHeight == tdStatus.clientHeight + divDetails.clientHeight;
                                }


                                window.onload = hideStatusDetails();
                         </script>

Open in new window


Thanks, Thomas
0
Comment
Question by:nutsch
  • 3
5 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39851250
Change .visibility to .display then use none/block to hide/show

e.g.
divDetails.style.display= "none";

Using visibility just hides the object but maintains the space used. Using display removes it from the page
0
 
LVL 2

Expert Comment

by:DualCool
ID: 39851251
can you show your css and full table code?
0
 
LVL 2

Expert Comment

by:DualCool
ID: 39851254
on first glance it looks like your div that has the mouseover/out events needs a height/width
0
 
LVL 2

Expert Comment

by:DualCool
ID: 39851278
also declare trStatus in your javascript

var trStatus = document.getElementById("trStatus");
0
 
LVL 39

Author Closing Comment

by:nutsch
ID: 39851298
Thanks all. The .display solution worked perfectly for my needs.

Thomas
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question