Dynamically enable menu item - (not based on roles)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nilla

    Dynamically enable menu item - (not based on roles)

    Hi!

    Im trying to disable/enable menu items in my webproject depending on
    some values.
    The menu is defined in a masterpage and has a sitemap associated to
    it.
    I have written some code in mymaster.master .cs for the
    myMenu_DataBoun d()-method that disables the manuitems as I want to.
    protected void myMenu_DataBoun d(object sender, EventArgs e)
    {

    foreach (MenuItem mi in issueMenu.Items )
    {
    if ("this and that" ) //blabla.... you got the point
    mi.Enabled = true;
    else
    mi.Enabled = false;
    }
    }

    This works fine. But when the user changes some parameters in the
    site, the disabled menuitems should be enabled again - how do I make
    myMenu_DataBoun d to be "re-run"? (A refresh on the page will not do
    it)

    Thanks in advance!
    /Nilla

  • Munna

    #2
    Re: Dynamically enable menu item - (not based on roles)

    On May 28, 4:44 pm, Nilla <vio...@hotmail .comwrote:
    Hi!
    >
    Im trying to disable/enable menu items in my webproject depending on
    some values.
    The menu is defined in a masterpage and has a sitemap associated to
    it.
    I have written some code in mymaster.master .cs for the
    myMenu_DataBoun d()-method that disables the manuitems as I want to.
     protected void myMenu_DataBoun d(object sender, EventArgs e)
        {
    >
            foreach (MenuItem mi in issueMenu.Items )
            {
                if ("this and that" )  //blabla.... you got the point
                    mi.Enabled = true;
                else
                    mi.Enabled = false;
            }
        }
    >
    This works fine. But when the user changes some parameters in the
    site, the disabled menuitems should be enabled again - how do I make
    myMenu_DataBoun d to be "re-run"? (A refresh on the page will not do
    it)
    >
    Thanks in advance!
    /Nilla
    Hi nilla

    There is nothing wrong with your code ... and certainly some thing
    wrong with you condition checking..
    master page's code execute first and then page's code ... so please
    check your parameter assignment code execure before your condition
    check...

    Best of luck

    Munna

    Comment

    • Nilla

      #3
      Re: Dynamically enable menu item - (not based on roles)

      On 28 Maj, 14:08, Munna <munna...@gmail .comwrote:
      On May 28, 4:44 pm, Nilla <vio...@hotmail .comwrote:
      >
      >
      >
      >
      >
      Hi!
      >
      Im trying to disable/enable menu items in my webproject depending on
      some values.
      The menu is defined in a masterpage and has a sitemap associated to
      it.
      I have written some code in mymaster.master .cs for the
      myMenu_DataBoun d()-method that disables the manuitems as I want to.
       protected void myMenu_DataBoun d(object sender, EventArgs e)
          {
      >
              foreach (MenuItem mi in issueMenu.Items )
              {
                  if ("this and that" )  //blabla.... you got the point
                      mi.Enabled = true;
                  else
                      mi.Enabled = false;
              }
          }
      >
      This works fine. But when the user changes some parameters in the
      site, the disabled menuitems should be enabled again - how do I make
      myMenu_DataBoun d to be "re-run"? (A refresh on the page will not do
      it)
      >
      Thanks in advance!
      /Nilla
      >
      Hi nilla
      >
      There is nothing wrong with your code ... and certainly some thing
      wrong with you condition checking..
      master page's code execute first and then page's code ... so please
      check your parameter assignment code execure before your condition
      check...
      >
      Best of luck
      >
      Munnawww.munna. shatkotha.com- Dölj citerad text -
      >
      - Visa citerad text -
      Did you got my reply yesterday? I accidently pressed "Answer author"
      instead of "Answer" so I cant wee my reply here...

      Comment

      • Nilla

        #4
        Re: Dynamically enable menu item - (not based on roles)

        On 29 Maj, 08:44, Nilla <vio...@hotmail .comwrote:
        On 28 Maj, 14:08, Munna <munna...@gmail .comwrote:
        >
        >
        >
        >
        >
        On May 28, 4:44 pm, Nilla <vio...@hotmail .comwrote:
        >
        Hi!
        >
        Im trying to disable/enable menu items in my webproject depending on
        some values.
        The menu is defined in a masterpage and has a sitemap associated to
        it.
        I have written some code in mymaster.master .cs for the
        myMenu_DataBoun d()-method that disables the manuitems as I want to.
         protected void myMenu_DataBoun d(object sender, EventArgs e)
            {
        >
                foreach (MenuItem mi in issueMenu.Items )
                {
                    if ("this and that" )  //blabla.... you got the point
                        mi.Enabled = true;
                    else
                        mi.Enabled = false;
                }
            }
        >
        This works fine. But when the user changes some parameters in the
        site, the disabled menuitems should be enabled again - how do I make
        myMenu_DataBoun d to be "re-run"? (A refresh on the page will not do
        it)
        >
        Thanks in advance!
        /Nilla
        >
        Hi nilla
        >
        There is nothing wrong with your code ... and certainly some thing
        wrong with you condition checking..
        master page's code execute first and then page's code ... so please
        check your parameter assignment code execure before your condition
        check...
        >
        Best of luck
        >
        Munnawww.munna. shatkotha.com-Dölj citerad text -
        >
        - Visa citerad text -
        >
        Did you got my reply yesterday? I accidently pressed "Answer author"
        instead of "Answer" so I cant wee my reply here...- Dölj citerad text -
        >
        - Visa citerad text -
        :-D wee == see :-)

        Comment

        Working...