Ticket T586150
Visible to All Users

How to set active tab in a Web DetailView layout after executing an Action

created 7 years ago

Hello,

i need a solution for activating a specific tab after an action was executed.
Currently i was trying to get the PageControl like this:

C#
protected override void OnActivated() { base.OnActivated(); if (View is DetailView detailView) { ((WebLayoutManager)detailView.LayoutManager).PageControlCreated += OnPageControlCreated; } } ASPxPageControl pageControl; private void OnPageControlCreated(object sender, PageControlCreatedEventArgs e) { if (View is DetailView detailView && e.Model.Id == "TabbedGroup") { pageControl = e.PageControl; ((WebLayoutManager)detailView.LayoutManager).PageControlCreated -= OnPageControlCreated; } }

This works fine.

After my action i want to do this:

C#
pageControl.ActiveTabIndex = 3;

Internally the the Index is changed, but visual there is no change.

Any solutions?

Comments (1)
Andrey K (DevExpress Support) 7 years ago

    Hello,

    As this question is more related to ASPxPageControl, I am passing this thread to our ASP team for the most precise answer. If you face any difficulties with integrating a solution into a XAF application, let me know.

    Thanks,
    Andrey

    Answers approved by DevExpress Support

    created 7 years ago (modified 7 years ago)

    Hello,

    As it turned out to be an XAF specific in the question, I will answer it by myself (I discussed it with our ASP specialists).
    To set an active page of ASPxPageControl when an action button is clicked perform the following steps.
    - access ASPxPageControl as shown in the E372: How to access a tab control in a Detail View layout thread and get it ClientID property value.
    - use the ActionBase.SetClientScript to find a client side ASPxPageControl by its id (from the step one), and call its client ASPxClientTabControlBase.SetActiveTabIndex method.

    I have attached a simple example that illustrates this approach (refer to a Contact's detail view). Try it and let me know how it works.

    Thanks,
    Andrey

      Comments (2)

        Thank you very much. It works well!

        Andrey K (DevExpress Support) 7 years ago

          You are welcome!

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.