Ticket Q214231
Visible to All Users
Duplicate

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

ConditionalAppearance - How do I customize the item caption text based on a certain condition

Conditionaly set DetailViewItem's Caption

created 16 years ago

Hi Guys,
how can i set the caption of an DetailView Item via an Controller? Simply setting the DetailViewItem.Caption dont work since the setter is empty in you source code:
[Description("Returns the current Detail View Item's caption.")]
          public virtual string Caption {
               get { return ""; }
               set { }
          }
I need to set the Caption via an controller, win/web without saving it to the model…?
thx
Noxe

Comments (2)
Anatol (DevExpress) 16 years ago

    Hello Noxe,
    To change the caption in the Windows Forms application, use the following code:

    C#
    protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); PropertyEditor propertyEditor = (PropertyEditor)((DetailView)View).FindItem("Property1"); int hashCode = propertyEditor.Control.GetHashCode(); foreach (BaseLayoutItem item in ((LayoutControl)View.Control).Items) { if (item is LayoutControlItem) { if (((LayoutControlItem)item).Control.GetHashCode() == hashCode) { item.Text = //... break; } } } }

    In a web application, get the Literal control, as shown in the Detail View Item: Change Caption Color issue, and change its text.
    Thanks,
    Anatol

    M M
    Martin Praxmarer - DevExpress MVP 16 years ago

      Great - thx Anatol!

      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.