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
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
Hello Noxe,
To change the caption in the Windows Forms application, use the following code:
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
Great - thx Anatol!