Dynamically enable menu item - (not based on roles)

  • Thread starter Thread starter Nilla
  • Start date Start date
N

Nilla

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_DataBound()-method that disables the manuitems as I want to.
protected void myMenu_DataBound(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_DataBound to be "re-run"? (A refresh on the page will not do
it)

Thanks in advance!
/Nilla
 
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_DataBound()-method that disables the manuitems as I want to.
 protected void myMenu_DataBound(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_DataBound 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
www.munna.shatkotha.com
 
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...
 
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 :-)
 
Back
Top