473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamic menu centering

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
4 4055
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Lachlan Hunt | last post by:
Hi, I've been trying, but failing to work out what is causing Opera to render my drop down menu incorrectly on my site. http://www.lachy.id.au/ For some reason, there seems to be extra margin...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
19
by: mart2006 | last post by:
I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters what is shown in the dynamic menu....
1
by: Uriah Piddle | last post by:
Hi Gang, I have a horizontal asp menu in a div. I centered the menu by setting the text-align prop of the div to 'center' and that works in IE. But with the other browsers, the menu aligns left....
1
by: Steve Richter | last post by:
I am using <div align=centerto center a horizontal menu on the page. Problem is the center align of the div is rippling down to the menu items and causing the text of the dynamic popup sub menu...
10
by: mart2006 | last post by:
Hi, I'm fairly new to PHP and I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
16
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of...
2
by: Jeff | last post by:
hi asp.net 2.0 I wan thte menu to be horizontally centered on the webpage, but I want the submenuitems to left aligned. So I created a table cell with HorizontalAlign set to Center. With this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.