473,698 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4065
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.nos pamwrote in message
news:ek******** ******@TK2MSFTN GP06.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.nos pamwrote in message
news:ek******** ******@TK2MSFTN GP06.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="Ho rizontal"
>
<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****@microsof t.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.nos pam>
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.nos pamwrote in message
news:ek******* *******@TK2MSFT NGP06.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.comw rote in message
news:Kg******** ******@TK2MSFTN GHUB02.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="Ho rizontal"
>
<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****@microsof t.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.nos pam>
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.nos pamwrote in message
news:ek****** ********@TK2MSF TNGP06.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
3420
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 added below each list item, that gets bigger for each subsequent item. Can someone please take a look and see if they can find my problem? It works almost perfectly in Firefox so you can see how it should look. It degrades
1
17664
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 Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
19
258993
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. For example, the first menu has three cities London, Paris, New York. If I choose London it populates the second menu with people from London. Here is the code I have for my dynamic menu <td valign=top><strong>Name:</strong></td> <td>...
1
1320
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. I tried fiddling around with padding but that does not work because items are added to the menu at runntime and I can never know the width of the menu. Thanks for any ideas.
1
3121
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 items to be centered also. How can I center my navigation menu without centering the menu item text? thanks, -Steve
10
57037
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 what is shown in the dynamic menu. For example, the first menu has three cities London, Paris, New York. If I choose London it populates the second menu with people from London. Here is the code I have for my dynamic menu <td...
19
3682
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 code for this from a tutorial but that menu was flush-left justified. Not what I want. Subsequent searches on google on how to center yielded a
16
4929
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 "background" or "background-image", the positioning only works with specifying pixels. If I specify the vertical position in pixels, the image gets cut-off at the bottom. I don't know what to do and would appreciate anyone's help. Specifically the code...
2
2797
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 option set the menu was horizontaly centered as I wanted, except that also submenuitems was centered too (not what I wanted). So then I tryed to add a extra div around the menu (<div style="text-align:left; margin-left:auto;
0
8674
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8861
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.