Ticket Q563644
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Changed tabbedgroup caption/text in dashboard view

Dynamic tab captions XAF Web

created 11 years ago

Hi DevExpress team
I would like to know if it is at all possible to change the caption on tabs (for example "Item1" to "Invoice No 2") at runtime for an XAF web application?

Trent

Answers approved by DevExpress Support

created 11 years ago (modified 5 years ago)

Hi Trentin.
This question has been already discussed in our Support Center. Please refer to ticket Changed tabbedgroup caption/text in dashboard view.
UPDATE:
The following controller seems to work correctly in your project.

C#
public class LayoutElementViewController : ViewController<DetailView> { ASPxPageControl pageControl = null; IModelLayoutGroup mlg = null; public LayoutElementViewController() { } protected override void OnActivated() { base.OnActivated(); ((WebLayoutManager)View.LayoutManager).PageControlCreated += OnPageControlCreated; View.CurrentObjectChanged += View_CurrentObjectChanged; ((WebLayoutManager)View.LayoutManager).ItemCreated += LayoutElementViewController_ItemCreated; } void LayoutElementViewController_ItemCreated(object sender, ItemCreatedEventArgs e) { if (e.ModelLayoutElement.Id == "Item1") { e.TemplateContainer.Init += TemplateContainer_Init; } } void TemplateContainer_Init(object sender, EventArgs e) { SetTabCaption(); } private void View_CurrentObjectChanged(object sender, EventArgs e) { SetTabCaption(); } protected override void OnDeactivated() { ((WebLayoutManager)View.LayoutManager).ItemCreated -= LayoutElementViewController_ItemCreated; View.CurrentObjectChanged -= View_CurrentObjectChanged; ((WebLayoutManager)View.LayoutManager).PageControlCreated -= OnPageControlCreated; base.OnDeactivated(); } private void OnPageControlCreated(object sender, PageControlCreatedEventArgs e) { if (e.Model.Id == "Item2") { pageControl = e.PageControl; pageControl.Disposed += (object sender2, EventArgs e2) => { pageControl = null; }; } } void SetTabCaption() { IDoc doc = View.CurrentObject as IDoc; if (pageControl != null && pageControl.TabPages.Count > 0) { pageControl.TabPages[0].Text = doc == null ? "*empty*" : string.Format("Number:{0} - Status:{1}", doc.Number, doc.Status); } } }
    Show previous comments (1)
    DevExpress Support Team 11 years ago

      Thank you for your reply. I have updated my answer. Let me know if I can help you further.

        Thanks Michael

        DevExpress Support Team 11 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.