473,320 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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_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

Jun 27 '08 #1
3 3283
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_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
Jun 27 '08 #2
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_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

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...
Jun 27 '08 #3
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_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
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 :-)
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: rufus | last post by:
I am created a table dynamically and I have wrapped it in a div tag so that the user can scroll the table horizontally ie I have added an overflow property to the div. I dont want the user to be...
0
by: naijacoder naijacoder | last post by:
Here goes the scenario.. The intranet is using windows Auth integrated wih Active Directory. Which is fine and all the appropriate Roles/Groups are set. When a user clicks on a button on a page...
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
7
by: Steve_Black | last post by:
Hello, I'm toying with the idea of loading a MenuStrip (VB.Net 2005) dynamically based on who is logged into my system. Every user has different security settings and I want to customize the...
0
by: John Smith | last post by:
I still have not gotten this damn thing figured out and I'm asking for help one last time before I give up on it. I have a user control that contains a paged gridview control. The master page...
1
by: John Devlon | last post by:
Hi, Can someone please help me. I've got a strang problem in Visual Studio 2005 I've created a windows application, using an MDI form and top menu. When a menu item is clicked, a new instance...
0
by: rmgalante | last post by:
Hi, I've got my site configured to use a menu control, a site map, security trimming, and roles. Everything seems to be working, except I have the following problem. If I define a...
1
by: Seth Williams | last post by:
Let's say I have an ASP.Net menu, with a datasourceID of a siteMapPath, which of course is based on a web.sitemap file Based on the person logged into the page, I have code in files in the...
4
by: =?Utf-8?B?bmVlcmFqYkBub2lkYS5ub3NwYW1oY2x0ZWNoLmNv | last post by:
Hi, I have a question with respect to the security implementation of Menu using sitemap. Normally in the sitemap we can implement role based security but that is based on the Role based...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.