asp:Menu

W

win

I've create menu in a webform.

<asp:Menu ID="Menu1" runat="server" CssClass="toolbar"
Orientation="Horizontal">
<Items>
<asp:MenuItem Text="Master" Value="Master">
<asp:MenuItem Text="Maintenance"
Value="Maintenance">
<asp:MenuItem Text="Employee Maintenance
" Value=" Employee Maintenance ">
</asp:MenuItem>
</asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>

However I don't want to copy the code to all other webforms.
What should I do?

Thank you very much
 
M

Madhur

You should consider using MasterPages to retain the common look and feel
across all pages.

Otherwise, if you are just looking to resuse this control, you can embed
this code into user controls
and custom control and reuse across pages.
 
S

Steven Cheng [MSFT]

Hi Win,

As for the "copy the code" you mentioned, do you mean you want to reuse the
Menu control's code template in multiple pages? if this is the case, I
think you can consider the following approachs:

1. As Madhur has suggested, you can define a base page template which can
be reused by multiple content page. In asp.net 2.0, this is called Master
page:

#ASP.NET Master Pages Overview
http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx

#Master Pages In ASP.NET 2.0
http://www.odetocode.com/Articles/419.aspx


2. You can also consider create an ascx user control that contains such a
Menu and then reuse this usercontrol in multiple ASP.NET page:

#Walkthrough: Creating Reusable Elements with ASP.NET User Controls
http://msdn.microsoft.com/en-us/library/3457w616(VS.80).aspx

If you have any other considerations, welcome to post here.

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

Steven Cheng [MSFT]

Hi Win,

Does the information in our previous messages help you? If you have
anything unclear, please feel free to post here.

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.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Content-Transfer-Encoding: 7bit
From: (e-mail address removed) (Steven Cheng [MSFT])
Organization: Microsoft
Date: Tue, 20 May 2008 08:16:22 GMT
Subject: RE: asp:Menu
 

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

Top