In the SalesLogix web client, the various smartparts are loaded onto a page and then rendered as the normal SalesLogix interface with tabs, detail views, etc. Sometimes it is helpful to be able to access the parent page from the user control.
One such situation came up for me recently where I was asked to dynamically change the main title that appears in the Web client. Now this is different than the Page Title as implemented on the System.Web.UI.Page. The EntityPage has specific SalesLogix attributes including that SalesLogix Title. To access the parent EntityPage you can do either of these things:
Sage.Platform.WebPortal.EntityPage ep = (Sage.Platform.WebPortal.EntityPage)this.Page
Notice in the second option we simply cast the underlying System.Web.UI.Page to the EntityPage.
Now with that reference we can access properties of the EntityPage, like the Page Title. So you can do something like this to set the title:
this.EntityPage.TitleBar.Text = “My new title”;
Now the SalesLogix title will appear as whatever you specify there.
You can also do some additional checking to see what state the EntityPage is in so that you can control the title differently depending on if you are in list vs detail modes. Like so:
Sage.Platform.WebPortal.EntityPage ep = this.EntityPage;
Sage.Platform.Application.IEntityContextService entityContext = ep.PageWorkItem.Services.Get<Sage.Platform.Application.IEntityContextService>();
if (ep.ViewMode == Sage.Platform.Orm.Entities.EntityViewMode.Detail)
ep.TitleBar.Text = Server.HtmlEncode(this.EntityPage.TitleBar.Text + “ some other title stuff when in detail mode”);