Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a Issue in following Code:

XML
<table width="100%">
    <tr style="height: 130px">
        <td>
            <asp:GridView ID="gvwSch"runat="server"
            AllowPaging="true" Width="100%"
            PageSize="5">
            </asp:GridView>
        </td>
    </tr>
</table>



When my grid view have more than 5 records , Height of all grid view's Rows will be proper , but when my grid view have 1 records it show's the single record with the same height of 130px , Where I want grid view Height to be 20px. but The Tables Height Should be 130px Itself.

Please help me...
Posted
Comments
BobJanova 16-Mar-12 10:04am    
Well clearly the problem is the 'height=130px'.

I think to give the height in px is not a good prectice.
please try to give it in "Percentage" it will surly solve your problem
XML
<table width="100%">
    <tr style="height: 30%">
        <td>
            <asp:GridView ID="gvwSch"runat="server"
            AllowPaging="true" Width="100%"
            PageSize="5">
            </asp:GridView>
        </td>
    </tr>
</table>



THen another good solution for you is to make the grid scrollable after the specified records are excedded.use the
tag and make it scrollable.
this will give you better look on the screen.
 
Share this answer
 
Try This Stuff It will work in this way you can customize your gridview...
ASP.NET
<asp:GridView ID="gdvText" runat="server" AllowPaging="True" 
                                                            AutoGenerateColumns="False" BackColor="White" BorderColor="Black"          BorderStyle="Ridge" BorderWidth="2px" CellPadding="8" CellSpacing="1" 
ForeColor="#330099" GridLines="None" HeaderStyle-BorderColor="Black"    RowStyleBackColor="White" >
 <rowstyle backcolor="#DEDFDE" forecolor="Black" />
  <footerstyle backcolor="#C6C3C6" forecolor="Black" />
  <pagerstyle backcolor="#C6C3C6" forecolor="Black" horizontalalign="Right" />
  <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
   <HeaderStyle BackColor="#99CCFF" Font-Bold="True" ForeColor="black" />
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900