how to make height of gridview

Posted on 2007-08-07
Last Modified: 2012-06-27
I have gridview that has div, and I put a headerfixed on it, only thing is, if my data is short this much height I don't want to see, I want height to be adjusted accordingly to my data, if it is too many records heights going to be more, if less less height. How can I do that without effecting my fixedheader?
<div style="width: 530px; overflow:auto; height: 200px;" >
Question by:jaws1021
    LVL 12

    Accepted Solution

    if you want to set height dynamically you can use javascript like

    <div style="width: 530px; overflow:auto; height: 200px;" id = "MYDIV">

    document.getElementById("MYDIV").style.height =  120;

    where MYDIV is id of the div !! you can set size like this !! Get the record count in a hidden field and according to the value set height!!


    Author Comment

    can you give me an example about getting record count in a hidden filed and set the height that way?
    LVL 16

    Assisted Solution

    My advise is to set a fixed rows height.  that way you dont have to mess about with your header div.

    Author Comment

    my rows are not fixed though. They are changing depends on data..
    LVL 16

    Expert Comment

    can we see any example of this page?

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
    Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
    In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
    In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now