RadRibbonBar ContextualTabGroup

6 posts, 0 answers
  1. Brigite
    Brigite avatar
    1 posts
    Member since:
    Jan 2012

    Posted 13 Jan 2012 Link to this post

    Hi,

    I am using the ASP.NET component RadRibbonBar(latest version - Q3 2011)  and I have a question about the usage of the ContextualTabGroup.

    How can I  activate and deactivate a ContextualTabGroup depending on the options selected in a Tab (RibbonBarButton) ?

    Since is not possible to have an ID to the RibbonBarContextualTabGroup, I wonder how I can activate or deactivate the component in the server-side ?

    Best regards,

    Brigite Pedro

  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 18 Jan 2012 Link to this post

    Hello Brigite,

    You can use the Active property of the RibbonBarContextualTabGroup and set it to false on the server side (see the code below):
    <telerik:RadButton runat="server" ID="button1" Text="buuton1" OnClick="button1_Click">
        </telerik:RadButton>
        <br />
        <telerik:RadRibbonBar ID="ribbon1" runat="server" Skin="Outlook">
            <ContextualTabGroups>
                <telerik:RibbonBarContextualTabGroup Text="TAB1" Active="true">
                    <Tabs>
                        <telerik:RibbonBarTab Text="tab1">
                        </telerik:RibbonBarTab>
                        <telerik:RibbonBarTab Text="tab2">
                        </telerik:RibbonBarTab>
                        <telerik:RibbonBarTab Text="tab2">
                        </telerik:RibbonBarTab>
                    </Tabs>
                </telerik:RibbonBarContextualTabGroup>
                <telerik:RibbonBarContextualTabGroup Text="TAB2" Active="true">
                    <Tabs>
                        <telerik:RibbonBarTab Text="tab1">
                        </telerik:RibbonBarTab>
                        <telerik:RibbonBarTab Text="tab2">
                        </telerik:RibbonBarTab>
                        <telerik:RibbonBarTab Text="tab2">
                        </telerik:RibbonBarTab>
                    </Tabs>
                </telerik:RibbonBarContextualTabGroup>
            </ContextualTabGroups>
        </telerik:RadRibbonBar>
     
    code behind:
    protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void button1_Click(object sender, EventArgs e)
        {
            ribbon1.ContextualTabGroups[0].Active = false;
        }

    Greetings,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. guy
    guy avatar
    5 posts
    Member since:
    Oct 2015

    Posted 02 Dec 2015 in reply to Kate Link to this post

    hi,

    i have another question about this post.

    there is way to activate / deactivate the contextual tabs without refresh the whole page, like in AJAX or something ?

  5. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    290 posts

    Posted 03 Dec 2015 Link to this post

    Hi Guy,

    You can easily activate or deactivate tabs in a RibbonBarContextualTabGroup through the RibbonBar's client-side API by using their set_enabled(bool) method. Below you can find possible implementation showing how to disable the second Tab of the first TabGroup by handling OnClientClicking event of a RadButton:

    function onClientButtonClicking(sender, args) {
        var ribbonBar = $find("<%= ribbon1.ClientID %>");
        var tabGroup = ribbonBar.findContextualTabGroupByText("TAB1");
        var tabToDisable = tabGroup.get_tabs()[1];
     
        if (tabToDisable) {
            tabToDisable.set_enabled(false);
        }
     
        args.set_cancel(true);
    }

    If you have any further questions, please do not hesitate to contact us.

    Regards,
    Veselin Tsvetanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. guy
    guy avatar
    5 posts
    Member since:
    Oct 2015

    Posted 03 Dec 2015 in reply to Veselin Tsvetanov Link to this post

    Thanks a lot, very helpful
  7. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    290 posts

    Posted 07 Dec 2015 Link to this post

    Hi Guy,

    I am glad we were able to help.

    Regards,
    Veselin Tsvetanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017