Dynamic menu centering

S

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
 
S

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
 
S

Steven Cheng [MSFT]

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:
(e-mail address removed).

==================================================
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.

--------------------
 
S

SAL

Thanks again for you great support Steven.

S

Steven Cheng said:
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:
(e-mail address removed).

==================================================
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top