How to leave my GridView in the middle of the screen?

1

How to leave my GridView c # in the middle of the screen?

I've tried putting it in a div and alrib = aling center = but it did not work out.

Does anyone have a suggestion?

<asp:GridView ID="GridView1" runat="server" CellPadding="4"
        ForeColor="#333333" GridLines="None" HorizontalAlign = "Center">
    <AlternatingRowStyle BackColor="White" />
    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
    <SortedAscendingCellStyle BackColor="#FDF5AC" />
    <SortedAscendingHeaderStyle BackColor="#4D0000" />
    <SortedDescendingCellStyle BackColor="#FCF6C0" />
    <SortedDescendingHeaderStyle BackColor="#820000" />
</asp:GridView>
    
asked by anonymous 26.09.2014 / 00:08

1 answer

0

Alright?

When you are creating a GridView on an ASP.Net page, one of the things you can try is to put a <div></div> around it in order to center the GridView on the page, by assigning text-align: center to your div, but this will not work. Because the latest CSS do not work this way = (.

In order to do this, assuming you have a CSS class that you are using with GridView, simply add the following CSS to your class:

margin-left: auto;
margin-right: auto;

I hope I have helped.

    
27.09.2014 / 08:19