My master page has this markup
<ext:Panel ID="panTopMenu" runat="server" Margins="5" Height="50" Border="false"
Header="false" Region="North">
<TopBar>
<ext:Toolbar runat="server">
<Content>
<asp:ContentPlaceHolder ID="topMenuBarContent" runat="server">
</asp:ContentPlaceHolder>
</Content>
<Items>
</Items>
</ext:Toolbar>
</TopBar>
</ext:Panel>
my page has this markup in a content place holder because my toolbar control resides on a master page, see above.
<asp:Content ID="Content2" ContentPlaceHolderID="topMenuBarContent" runat="server">
<ext:HBoxLayout ID="HBoxLayout1" runat="server" Align="Middle">
<BoxItems>
<ext:BoxItem>
<ext:Button ID="cmdListMedications" runat="server" Icon="Pill" Text="List Medications">
</ext:Button>
</ext:BoxItem>
<ext:BoxItem>
<ext:SplitButton ID="cmdAddMedication" runat="server" Icon="PillAdd" Text="Add Medication">
<Menu>
<ext:Menu runat="server" ID="mnuAddMedication">
<Items>
<ext:MenuItem ID="cmdAddCustomMedication" runat="server" Icon="PillAdd" Text="Add Custom Medication">
</ext:MenuItem>
</Items>
</ext:Menu>
</Menu>
</ext:SplitButton>
</ext:BoxItem>
</BoxItems>
</ext:HBoxLayout>
</asp:Content>
I have a method in my code behind like this to change the button state
protected void SetButtonState(ButtonBase button, bool disabled)
{
button.Disabled= disabled;
if (disabled)
{
button.ToolTip = "Not available at this time";
}
else
{
button.ToolTip = string.Empty;
}
if (X.IsAjaxRequest)
{
if (disabled)
{
button.SetTooltip(new QTipCfg() { Text = "Not available at this time" });
}
else
{
button.ToolTips.Clear();
}
button.Render();
}
}
if the user is allowed to edit the medication profile the add medication button should be enabled otherwise disable it. I would also be happy if I could hide the button entirely instead of disabling it and adding a tool tip.
This method is call during initial page load and is passed the cmdAddMedication control and works fine. At some point a user can update the medication profile and no longer be allowed to add medications. Once this happens I call this same method during a direct event and the whole toolbar disappears instead of just disabling the button and adding a tool tip. How do I correctly call the render method when the item I am rendering is inside an HBoxLayout?