Dynamically enable menu item - (not based on roles)

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
 
M

Munna

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
 
N

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...
 
N

Nilla

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 :)
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top