Runtime Enable/Disable LargeButton

May 18, 2011 at 3:19 PM

I have standard CRUD 3 button (Cancel,Edit,Save) in GroupZone as LargeButton

I disable 2 of its at runtime like this :

        protected void Page_Load(object sender, EventArgs e)
        {
            (Master as Main).MainWorkspace.SelectedAreaID = "Area_Organizations";
            (Master as Main).MainWorkspace.SelectedItemID = "Item_OrganizationList";

            (Master as Main).MainManager.AddInitScript("OfficeWebUI.Ribbon.ShowContext('ContextOrganizations')");
            (Master as Main).MainManager.AddInitScript("OfficeWebUI.Ribbon.ShowTab('TabOrganizations');");

            (Master as Main).MainRibbon.getRibbonItem<OfficeWebUI.Ribbon.LargeItem>("CancelLargeItem").Enabled = false;
            (Master as Main).MainRibbon.getRibbonItem<OfficeWebUI.Ribbon.LargeItem>("SaveLargeItem").Enabled = false;

 

When press Edit LargeButton..

        private void ToggleButtonsStatus(bool bEditMode)
        {
            (Master as Main).MainRibbon.getRibbonItem<OfficeWebUI.Ribbon.LargeItem>("CancelLargeItem").Enabled = bEditMode;
            (Master as Main).MainRibbon.getRibbonItem<OfficeWebUI.Ribbon.LargeItem>("SaveLargeItem").Enabled = bEditMode;
            (Master as Main).MainRibbon.getRibbonItem<OfficeWebUI.Ribbon.LargeItem>("EditLargeItem").Enabled = !bEditMode;
        }

 

 

All run OK, but after Cancel LargeButton is pressed (and set ToggleButtonsStatus)

all 3 buttons no longer work !!

 

PS: if rem the procedures to enable/disable buttons ALL run OK !!

 

Could you help me ?

May 19, 2011 at 11:46 AM

Maybe have solved myself ...

seems to be enough to remove this line in LargeItems.cs...

        private void _EnableState(Boolean state)
        {
            if (_Panel != null)
            {
                if (!state)
                {
                    _Panel.CssClass += " Disabled";
                    //_Panel.Attributes["onclick"] = "";
                }
                else {
                    _Panel.CssClass = _Panel.CssClass.Replace(" Disabled", "");
                }
            }
        }