By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,293 Members | 1,397 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,293 IT Pros & Developers. It's quick & easy.

Dynamic menu centering

P: n/a
SAL
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
Jul 2 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
SAL
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" <SA*@nospam.nospamwrote in message
news:ek**************@TK2MSFTNGP06.phx.gbl...
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

Jul 2 '08 #2

P: n/a
SAL
Thanks for not answering this stupid question. I got it... :)

S

"SAL" <SA*@nospam.nospamwrote in message
news:ek**************@TK2MSFTNGP06.phx.gbl...
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

Jul 2 '08 #3

P: n/a
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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "SAL" <SA*@nospam.nospam>
References: <ek**************@TK2MSFTNGP06.phx.gbl>
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" <SA*@nospam.nospamwrote in message
news:ek**************@TK2MSFTNGP06.phx.gbl...
>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


Jul 3 '08 #4

P: n/a
SAL
Thanks again for you great support Steven.

S

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:Kg**************@TK2MSFTNGHUB02.phx.gbl...
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:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>From: "SAL" <SA*@nospam.nospam>
References: <ek**************@TK2MSFTNGP06.phx.gbl>
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" <SA*@nospam.nospamwrote in message
news:ek**************@TK2MSFTNGP06.phx.gbl...
>>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



Jul 3 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.