alignment for a listview in firefox and IE

Hi,
  I have shown the code below.
  How would I align it to the center of the page in both firefox and IE.
Thanks, LLJ45
<asp:ListView ID="lvLetter" runat="server" ItemPlaceholderID="itemPlaceholder">
                <LayoutTemplate>
                    <table>
                        <td id="itemPlaceholder" runat="server">
                        </td>
                    </table>
                </LayoutTemplate>
                
                <ItemTemplate>
                    <asp:LinkButton ID="lnkLetter" runat="server" Text='<%#Eval("letter")%>'
                        CommandName="Find" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Letter") %>'>
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:ListView>

Open in new window

llj45Asked:
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.

Obadiah ChristopherDeveloper User InterfaceCommented:
Place an enclosing div around the listview and provide an id to it.

OnLoad of the Body write a javascript function.

In js find the Height and Width of the body divide it by two.

Set the position of div to this value...
bklmnshCommented:
I believe the solution above is incomplete
I think it should be something like following:

div.top = body.height / 2 - div.height / 2
div.left = body.width / 2 - div.widht / 2
masterpassCommented:
after the body put a center tag

<body>
<center>
ListView here
</center>
</body>

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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

llj45Author Commented:
Hi,
  Thanks for the help!
  The listview still does NOT center on the page!

  I have attached the updated code.
Thanks, LLJ45
<script type="text/javascript" language="javascript">
            function center()
            {
                control.top = body.height / 2 - div.height / 2
                control.left = body.width / 2 - div.width / 2
            }
        </script>

    <body onload="center();">

            <div id="control">
            <asp:ListView ID="lvLetter" runat="server" ItemPlaceholderID="itemPlaceholder">
                <LayoutTemplate>
                    <table>
                        <td id="itemPlaceholder" runat="server">
                        </td>
                    </table>
                </LayoutTemplate>
                
                <ItemTemplate>
                    <asp:LinkButton ID="lnkLetter" runat="server" Text='<%#Eval("letter")%>'
                        CommandName="Find" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Letter") %>'>
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:ListView>
            </div>

Open in new window

masterpassCommented:
Try this
<body>
<center>
            <div id="control">
            <asp:ListView ID="lvLetter" runat="server" ItemPlaceholderID="itemPlaceholder">
                <LayoutTemplate>
                    <table>
                        <td id="itemPlaceholder" runat="server">
                        </td>
                    </table>
                </LayoutTemplate>
                
                <ItemTemplate>
                    <asp:LinkButton ID="lnkLetter" runat="server" Text='<%#Eval("letter")%>'
                        CommandName="Find" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Letter") %>'>
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:ListView>
            </div>
</center>
</body>

Open in new window

bklmnshCommented:
var control = document.getElementById("control");
control.top = document.body.clientHeigth / 2 - control.height / 2
control.left = document.body.clientWidth / 2 - control.width / 2
llj45Author 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.