Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Collapse]Views
    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 Applications
    How to: Display a List View as a 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]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[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 whether or not the current View is a Lookup List View. This can be helpful if you want to perform a certain customization in lookups only. For instance, you may want to hide the New Action displayed below the Lookup List View.

Implement a View Controller that targets List Views only. Override the OnActivated Method. Check that the Frame.Context value is LookupControl or LookupWindow. If it is true, this means that the current List View is a Lookup List View.

Tip

The New Action is provided by the NewObjectViewController. You can access this Controller using the Frame.GetControllers method and then access the NewObjectViewController.NewObjectAction property.

Note

  • Alternatively, you can detect a Lookup List View by its View.Id - by default, all Lookup List Views have identifiers with the "_LookupListView" suffix. However, you will also detect Views that were initially designed to be used as lookups, but may not actually be used as lookups. The approach described in this topic allows you to detect any List View used as a Lookup List View.
  • This topic describes how to hide the New Action in all lookups and detect whether or not a lookup Template is currently being used. If you want to hide this Action for a particular Lookup List View, find the corresponding View node in the Model Editor and set the IModelView.AllowNew property to false.

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

Expanded See Also

How would you rate this topic?​​​​​​​