Ticket T183808
Visible to All Users

Web - How to show links to referenced objects in ListView grid columns (Open Related Object or OpenObjectController in ASP.NET)

created 10 years ago

Prior to v2014 vol2, links to related business objects were shown by default in listviews. Now it is all plain text. What happened? How can I get the links back?

Thanks,

Ad

Answers approved by DevExpress Support

created 10 years ago (modified 5 years ago)

Hi Ad,

This is a specificity of the Data-Specific Column Types for ASPxGridView feature. To revert back to the old mode, consider one of the following options:
1. Set the static ASPxGridListEditor.UseASPxGridViewDataSpecificColumns property to false in the Global.asax.cs file. Take special note that we disabled these links in ASPxGridListEditor to achieve a better ListView loading performance by default.
OR
2. Enable data item templates for individual columns, e.g. for columns showing business objects using the ASPxGridListEditor.CreateCustomDataItemTemplate event:

C#
public class ViewController1 : ViewController<ListView> { ASPxGridListEditor gridListEditor; protected override void OnActivated() { base.OnActivated(); gridListEditor = View.Editor as ASPxGridListEditor; if (gridListEditor != null) { gridListEditor.CreateCustomDataItemTemplate += gridListEditor_CreateCustomDataItemTemplate; } } void gridListEditor_CreateCustomDataItemTemplate(object sender, CreateCustomDataItemTemplateEventArgs e) { if (e.ModelColumn.PropertyEditorType.IsSubclassOf(typeof(ASPxObjectPropertyEditorBase))) { e.CreateDefaultDataItemTemplate = true; } } protected override void OnDeactivated() { base.OnDeactivated(); if (gridListEditor != null) { gridListEditor.CreateCustomDataItemTemplate -= gridListEditor_CreateCustomDataItemTemplate; gridListEditor = null; } } }
Visual Basic
Public Class ViewController1 Inherits ViewController(Of ListView) Private gridListEditor As ASPxGridListEditor Protected Overrides Sub OnActivated() MyBase.OnActivated() gridListEditor = TryCast(View.Editor, ASPxGridListEditor) If gridListEditor IsNot Nothing Then AddHandler gridListEditor.CreateCustomDataItemTemplate, AddressOf gridListEditor_CreateCustomDataItemTemplate End If End Sub Private Sub gridListEditor_CreateCustomDataItemTemplate(sender As Object, e As CreateCustomDataItemTemplateEventArgs) If e.ModelColumn.PropertyEditorType.IsSubclassOf(GetType(ASPxObjectPropertyEditorBase)) Then e.CreateDefaultDataItemTemplate = True End If End Sub Protected Overrides Sub OnDeactivated() MyBase.OnDeactivated() If gridListEditor IsNot Nothing Then RemoveHandler gridListEditor.CreateCustomDataItemTemplate, AddressOf gridListEditor_CreateCustomDataItemTemplate gridListEditor = Nothing End If End Sub End Class

If you want a similar feature in Web DetailView for lookup editors, check solutions for ASPxLookupPropertyEditor and ASPxGridLookupPropertyEditor in Web - Open Related Record functionality in DetailView (Edit Mode).

See also:
UI.Web - Group rows show plain text in version 14.2
Performance.Web - Use data-specific column types instead of data item templates whenever possible

    Comments (2)

      Hi Konstantin,
      Thanks. Overall, the new approach appears to be for the better…:).
      However, I have one or two referenced properties that are very convenient for end-users. How can I best show these columns as a link?

      DevExpress Support Team 10 years ago

        Currently, this functionality is not supported - you cannot change the mode for individual columns. Only the global option is available (ASPxGridListEditor.UseASPxGridViewDataSpecificColumns).

        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.