How to set NavigateUrl of an asp:MenuItem when moving from QA toPROD?

Discussion in 'ASP .Net' started by MDaisy, Jun 14, 2009.

  1. MDaisy

    MDaisy Guest

    It is customary that the MenuItem NavigateUrl values either in a
    sitemap file or in a database.
    However, unfortunately, the consulting company that is developing the
    software package for the company that I work for has all menu items
    inline and hard-coded.
    I cannot change their menu implementation because they won't let me
    change it.

    Anyway, there is currently a menu item called Tools and under it there
    is a Search menu item
    I need to add an additional menu item with a NavigateUrl that points
    to SQL Server Report Manager so it changes when going from dev, to
    qa and to prod.
    Question: Is there a way for me to code a key in appsettings section
    of web.config and plug it as NavigateUrl for my additional menu item?
    web.config can be edited when promoting to another environment without
    having to compile the application.

    The menu is hard-coded in the master page of the entire web
    application.
    <asp:MenuItem Text="Tools" Selectable="false" >

    <asp:MenuItem Text="Search" NavigateUrl="~/
    Search.aspx"></asp:MenuItem>

    thank you.
     
    MDaisy, Jun 14, 2009
    #1
    1. Advertising

  2. On Sun, 14 Jun 2009 03:36:14 +0200, MDaisy <>
    wrote:

    > Question: Is there a way for me to code a key in appsettings section
    > of web.config and plug it as NavigateUrl for my additional menu item?
    > web.config can be edited when promoting to another environment without
    > having to compile the application.


    In your markup (page or user control):
    <asp:MenuItem Text="Reports" NavigateUrl="<%$ AppSettings:ReportServerUrl
    %>" />

    In your web.config, in the appSettings section:
    <add key="ReportServerUrl" value="http://example.org/" />

    --
    Joern Schou-Rode
    http://malamute.dk/
     
    Joern Schou-Rode, Jun 14, 2009
    #2
    1. Advertising

  3. Re: How to set NavigateUrl of an asp:MenuItem when moving from QA to PROD?

    MDaisy <> wrote in news:6c6e21f2-39aa-419c-8dbc-
    :

    > It is customary that the MenuItem NavigateUrl values either in a
    > sitemap file or in a database.
    > However, unfortunately, the consulting company that is developing the
    > software package for the company that I work for has all menu items
    > inline and hard-coded.
    > I cannot change their menu implementation because they won't let me
    > change it.
    >
    > Anyway, there is currently a menu item called Tools and under it there
    > is a Search menu item
    > I need to add an additional menu item with a NavigateUrl that points
    > to SQL Server Report Manager so it changes when going from dev, to
    > qa and to prod.
    > Question: Is there a way for me to code a key in appsettings section
    > of web.config and plug it as NavigateUrl for my additional menu item?
    > web.config can be edited when promoting to another environment without
    > having to compile the application.
    >
    > The menu is hard-coded in the master page of the entire web
    > application.
    > <asp:MenuItem Text="Tools" Selectable="false" >
    >
    > <asp:MenuItem Text="Search" NavigateUrl="~/
    > Search.aspx"></asp:MenuItem>
    >
    > thank you.



    Jeorn has given you a way to hard code in pointers. Another way to
    accomplish this is to create your own custom provider to feed the menu.
    I would personally opt for the custom direction in most cases, as it is
    more flexible and better decouples the UI from the data. If you do not
    expect any changes in the basic flow of the menu, however, it may be
    overkill, esp. the first time (due to learning curve).


    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    *******************************************
    | Think outside the box! |
    *******************************************
     
    Gregory A. Beamer, Jun 15, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rickie
    Replies:
    11
    Views:
    5,412
    Edwin Knoppert
    Jul 7, 2006
  2. Replies:
    1
    Views:
    1,176
  3. alexandis
    Replies:
    2
    Views:
    612
    alexandis
    Feb 4, 2008
  4. Julia B

    How to set width of menuitem

    Julia B, Mar 25, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    8,957
    Just Me
    Mar 26, 2008
  5. Rickie
    Replies:
    11
    Views:
    527
    Edwin Knoppert
    Jul 7, 2006
Loading...

Share This Page