Dynamic menu centering

Discussion in 'ASP .Net' started by SAL, Jul 2, 2008.

  1. SAL

    SAL Guest

    Hello,
    is there a way to menu control dynamically center itself horizontally on a
    page?
    I have placed a menu control in a panel control (no ajax) and would like it
    to center itself. Depending on whose logged in, the menu, or course,
    displays different items, sometimes just two items, other times many more.
    If all menu items are displaying, centering is not a problem but when only
    two items are displayed, the menu appears on the left hand side of the panel
    rather in the center of the panel.

    Any way to correct this? I have googled and looked in help with, of course,
    no help.

    Thanks
    SAL
    SAL, Jul 2, 2008
    #1
    1. Advertising

  2. SAL

    SAL Guest

    Okay, so setting the HorizontalAlign property of the panel control causes it
    to render as desired but in design mode there's an error parsing control:
    Object reference not set to an instance of the object message.

    S

    "SAL" <> wrote in message
    news:...
    > Hello,
    > is there a way to menu control dynamically center itself horizontally on a
    > page?
    > I have placed a menu control in a panel control (no ajax) and would like
    > it to center itself. Depending on whose logged in, the menu, or course,
    > displays different items, sometimes just two items, other times many more.
    > If all menu items are displaying, centering is not a problem but when only
    > two items are displayed, the menu appears on the left hand side of the
    > panel rather in the center of the panel.
    >
    > Any way to correct this? I have googled and looked in help with, of
    > course, no help.
    >
    > Thanks
    > SAL
    >
    SAL, Jul 2, 2008
    #2
    1. Advertising

  3. SAL

    SAL Guest

    Thanks for not answering this stupid question. I got it... :)

    S

    "SAL" <> wrote in message
    news:...
    > Hello,
    > is there a way to menu control dynamically center itself horizontally on a
    > page?
    > I have placed a menu control in a panel control (no ajax) and would like
    > it to center itself. Depending on whose logged in, the menu, or course,
    > displays different items, sometimes just two items, other times many more.
    > If all menu items are displaying, centering is not a problem but when only
    > two items are displayed, the menu appears on the left hand side of the
    > panel rather in the center of the panel.
    >
    > Any way to correct this? I have googled and looked in help with, of
    > course, no help.
    >
    > Thanks
    > SAL
    >
    SAL, Jul 2, 2008
    #3
  4. Hi SAL,

    For aligning html element in web page, you can also use the plain css style
    .. For exapmle the "text-align" just control how html elements within the
    certain element will display. And for your case, you can set the container
    element of your menu control as "text-align:center"

    =======================
    <div style="text-align:center">

    <asp:Menu ID="Menu1" runat="server" Orientation="Horizontal"
    >

    <Items>
    <asp:MenuItem Text="New Item1" Value="New
    Item1"></asp:MenuItem>
    <asp:MenuItem Text="New Item2" Value="New
    Item2"></asp:MenuItem>
    <asp:MenuItem Text="New Item3" Value="New
    Item3"></asp:MenuItem>


    </Items>
    </asp:Menu>

    </div>
    =========================

    that also works. Actually, this does be a common asked question when
    someone what the layout the certain control/element on the center of the
    page.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    >From: "SAL" <>
    >References: <>
    >Subject: Re: Dynamic menu centering
    >Date: Wed, 2 Jul 2008 15:31:21 -0700


    >
    >Okay, so setting the HorizontalAlign property of the panel control causes

    it
    >to render as desired but in design mode there's an error parsing control:
    >Object reference not set to an instance of the object message.
    >
    >S
    >
    >"SAL" <> wrote in message
    >news:...
    >> Hello,
    >> is there a way to menu control dynamically center itself horizontally on

    a
    >> page?
    >> I have placed a menu control in a panel control (no ajax) and would like
    >> it to center itself. Depending on whose logged in, the menu, or course,
    >> displays different items, sometimes just two items, other times many

    more.
    >> If all menu items are displaying, centering is not a problem but when

    only
    >> two items are displayed, the menu appears on the left hand side of the
    >> panel rather in the center of the panel.
    >>
    >> Any way to correct this? I have googled and looked in help with, of
    >> course, no help.
    >>
    >> Thanks
    >> SAL
    >>

    >
    >
    >
    Steven Cheng [MSFT], Jul 3, 2008
    #4
  5. SAL

    SAL Guest

    Thanks again for you great support Steven.

    S

    "Steven Cheng [MSFT]" <> wrote in message
    news:...
    > Hi SAL,
    >
    > For aligning html element in web page, you can also use the plain css
    > style
    > For exapmle the "text-align" just control how html elements within the
    > certain element will display. And for your case, you can set the container
    > element of your menu control as "text-align:center"
    >
    > =======================
    > <div style="text-align:center">
    >
    > <asp:Menu ID="Menu1" runat="server" Orientation="Horizontal"
    > >

    > <Items>
    > <asp:MenuItem Text="New Item1" Value="New
    > Item1"></asp:MenuItem>
    > <asp:MenuItem Text="New Item2" Value="New
    > Item2"></asp:MenuItem>
    > <asp:MenuItem Text="New Item3" Value="New
    > Item3"></asp:MenuItem>
    >
    >
    > </Items>
    > </asp:Menu>
    >
    > </div>
    > =========================
    >
    > that also works. Actually, this does be a common asked question when
    > someone what the layout the certain control/element on the center of the
    > page.
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    > Delighting our customers is our #1 priority. We welcome your comments and
    > suggestions about how we can improve the support we provide to you. Please
    > feel free to let my manager know what you think of the level of service
    > provided. You can send feedback directly to my manager at:
    > .
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    > ==================================================
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
    > --------------------
    >>From: "SAL" <>
    >>References: <>
    >>Subject: Re: Dynamic menu centering
    >>Date: Wed, 2 Jul 2008 15:31:21 -0700

    >
    >>
    >>Okay, so setting the HorizontalAlign property of the panel control causes

    > it
    >>to render as desired but in design mode there's an error parsing control:
    >>Object reference not set to an instance of the object message.
    >>
    >>S
    >>
    >>"SAL" <> wrote in message
    >>news:...
    >>> Hello,
    >>> is there a way to menu control dynamically center itself horizontally on

    > a
    >>> page?
    >>> I have placed a menu control in a panel control (no ajax) and would like
    >>> it to center itself. Depending on whose logged in, the menu, or course,
    >>> displays different items, sometimes just two items, other times many

    > more.
    >>> If all menu items are displaying, centering is not a problem but when

    > only
    >>> two items are displayed, the menu appears on the left hand side of the
    >>> panel rather in the center of the panel.
    >>>
    >>> Any way to correct this? I have googled and looked in help with, of
    >>> course, no help.
    >>>
    >>> Thanks
    >>> SAL
    >>>

    >>
    >>
    >>

    >
    SAL, Jul 3, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sentient Fluid

    Centering horizontal 'button' menu

    Sentient Fluid, Jan 2, 2005, in forum: HTML
    Replies:
    6
    Views:
    667
  2. Carolyn Marenger

    centering and padding in horizontal menu

    Carolyn Marenger, Mar 19, 2006, in forum: HTML
    Replies:
    7
    Views:
    857
    Jonathan N. Little
    Mar 20, 2006
  3. Luigi Donatello Asero

    Centering headers in menu.

    Luigi Donatello Asero, Aug 14, 2006, in forum: HTML
    Replies:
    18
    Views:
    690
    dorayme
    Aug 17, 2006
  4. Andrew

    Need help centering menu bar

    Andrew, Sep 25, 2006, in forum: HTML
    Replies:
    6
    Views:
    424
    Andrew
    Sep 25, 2006
  5. Uriah Piddle

    Centering a menu in a div

    Uriah Piddle, Feb 18, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    377
    John Timney \(MVP\)
    Feb 18, 2007
Loading...

Share This Page