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
We have closed this ticket because another page addresses its subject:
Changed tabbedgroup caption/text in dashboard viewHi 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
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);
}
}
}
Thank you for your reply. I have updated my answer. Let me know if I can help you further.
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.