Log In
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Collapse]eXpressApp Framework
 [Expand]Getting Started
 [Expand]Design-Time Features
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
    How to: Access Objects Selected in the Current View
    How to: Access the Master Object from a Nested List View
    How to: Create and Show a Detail View of the Selected Object in a Popup Window
    How to: Detect a Lookup List View in Code
    How to: Display a Detail View Directly in Edit Mode in ASP.NET and Mobile Applications
    How to: Display a List View as a Chart
    How to: Display a List View as a Pivot Grid Table and Chart
    How to: Display Several Views Side-by-Side
    How to: Hide Collection Properties in an Edit Mode Detail View for an ASP.NET Application
    How to: Implement a Singleton Business Object and Show its Detail View
    How to: Implement a View Item
    How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET)
    How to: Show a Custom Data-Bound Control in an XAF View (WinForms)
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Scheduler and Notifications
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions (FAQ)
 [Expand]API Reference
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Detect a Lookup List View in Code

This topic demonstrates how to check if the current View is a Lookup List View. This can be useful if you want to customize Lookups only, for instance, to hide the New Action displayed below the Lookup List View.


Mobile applications do not have a specific template for Lookup List Views and do not support the approach described in this topic.

Implement a View Controller that targets List Views only and override the OnActivated method. Check that the Frame.Context value is LookupControl or LookupWindow. If the condition is true, this means that the current List View is a Lookup List View.

You can now, for example, deactivate the New Action in all Lookups. Use the Frame.GetController<ControllerType> method to get the NewObjectViewController and then use the NewObjectViewController.NewObjectAction property to access the New Action.

Run a WinForms or ASP.NET application to ensure that the New Action is deactivated in all Lookup List Views.

You can also detect a Lookup List View by its View.Id: all Lookup List Views have identifiers with the "_LookupListView" suffix by default. However, this also detects Views that were initially designed as Lookups, but are not used as Lookups.


If you want to hide the New Action for a particular Lookup List View, find the corresponding View node in the Model Editor and set the IModelView.AllowNew property to false.

Expanded See Also

Is this topic helpful?​​​​​​​