Resize tr when inner div is hidden

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">
                                            <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
                            <script type="text/javascript">
                                var divDetails = document.getElementById("divStatusDetails");

                                function hideStatusDetails() {

                           = "hidden";
                           = "30px";

                                function showStatusDetails() {

                           = "visible";
                                    trStatus.clientHeight == tdStatus.clientHeight + divDetails.clientHeight;

                                window.onload = hideStatusDetails();

Open in new window

Thanks, Thomas
LVL 39
Who is Participating?
GaryConnect With a Mentor Commented:
Change .visibility to .display then use none/block to hide/show

e.g. "none";

Using visibility just hides the object but maintains the space used. Using display removes it from the page
can you show your css and full table code?
on first glance it looks like your div that has the mouseover/out events needs a height/width
also declare trStatus in your javascript

var trStatus = document.getElementById("trStatus");
nutschAuthor Commented:
Thanks all. The .display solution worked perfectly for my needs.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.