Set Gridview height to Percentage of Screen Height

I'm using ASP.net.
Is it possible to Set the Gridview height to Percentage of Screen Height rather than an absolute number of pixels?
Width seems to allow this.
AlHal2Asked:
Who is Participating?
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.

Karrtik IyerSoftware ArchitectCommented:
I am aware that by setting the dock property, it allows the grid to be same size of the parent (form/user control)
myGridView.Dock = DockStyle.Fill;// This can also be set to left, or right, etc..

Does this help you?
AndyAinscowFreelance programmer / ConsultantCommented:
I don't think so - because it can grow/shrink vertically based on the number of rows should the contents be modified dynamically.
Karrtik IyerSoftware ArchitectCommented:
In Asp.NET I was able to do the below, does this work for you? It sets as percentage of the of the parent form.
  <asp:GridView  ID="GridView1" runat="server" Width="50%" Height ="50%">
            
        </asp:GridView>

Open in new window

Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

AlHal2Author Commented:
I tried that.  When the grid had lots of rows it just passed the bottom of the screen.  I'd set it to be 20% of the screen height with verticals scrollbars.

<asp:GridView ID="GridView1" runat="server" DataKeyNames ="xxx"  
        AllowSorting="True" Font-Names="Arial" Font-Size="Small"  
        RowStyle-Wrap="False" BackColor="White" BorderColor="Silver"    
        AutoGenerateColumns="True" onsorting="GridView1_Sorting" Height="20%" Width ="80%">
           
            <RowStyle Wrap="False" />  
             
    </asp:GridView>
AndyAinscowFreelance programmer / ConsultantCommented:
What if you put the gridview inside another section and try to control the height of that section.
eg.
http://stackoverflow.com/questions/17562118/asp-net-gridview-within-scrollable-div-scroll-to-selectedindex

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
AlHal2Author Commented:
Thanks.
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
ASP.NET

From novice to tech pro — start learning today.