AlHal2
asked on
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.
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.
I don't think so - because it can grow/shrink vertically based on the number of rows should the contents be modified dynamically.
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>
ASKER
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_Sorti ng" Height="20%" Width ="80%">
<RowStyle Wrap="False" />
</asp:GridView>
<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"
<RowStyle Wrap="False" />
</asp:GridView>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks.
myGridView.Dock = DockStyle.Fill;// This can also be set to left, or right, etc..
Does this help you?