Jun 13, 2012, 5:31 PM
[CLOSED] Disable a MenuItem when button selected
I have created a Button with a Menu. The menu items are added in the behind code and all of that works:
...
<TopBar>
<ext:Toolbar runat="server"
<Items>
<ext:Button runat="server" Icon="Database" >
<Menu>
<ext:Menu ID="CfdbOptionsMenu" runat="server"
<%-- MenuItems dynamically create in behind code --%>
</Menu>
</ext:Button>
<ext:Label ID="CfdbVersionTitle" runat="server" />
</Items>
</ext:Toolbar>
</TopBar>
...
Behind Code ...protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
CFVDataContext dc = new CFVDataContext;
// Retrieve all available versions that can be selected.
var q = from c in dc.CfdbVersions
where c.IsActive == true
orderby c.Order descending
select c;
// Create the menu items
foreach (var c in q)
{
Ext.Net.MenuItems item = new Ext.Net.MenuItems()
{
Text = c.Description,
Icon = Icon.Database
};
item.addTo(CfdbOptionsMenu);
}
}
}
What I would like to do is whenever the button is selected to display the menuItems I need to iterate through the menu items and disable the item if the menuItem.Text == CfdbVersionTitle.Text. This could be done on the client side. What listener should I use and what is the best way to iterate through the menuitems. I need to do it each time the button displays the menuItems because the title might have changed since the last time the menuitems were shown.
Last edited by Daniil; Jun 14, 2012 at 3:23 PM.
Reason: [CLOSED]