zoukankan      html  css  js  c++  java
  • How to: Display a Detail View Directly in Edit Mode in ASP.NET Applications 如何:在ASP.NET应用程序中直接在编辑模式下显示详细信息视图

    In ASP.NET applications, when clicking a record in a List View, a Detail View is displayed in view mode. However, the SwitchToEditMode Action is available, and you can use it to reload the Detail View in edit mode. This is the default behavior. In individual scenarios, you may need to invoke a Detail View directly in edit mode. This topic demonstrates how to omit the display in view mode for a particular object type.

    在ASP.NET应用程序中,单击列表视图中的记录时,在视图模式下显示详细信息视图。但是,"切换到编辑模式"操作可用,您可以使用它以编辑模式重新加载详细信息视图。这是默认行为。在个别方案中,您可能需要直接在编辑模式下调用"详细信息视图"。本主题演示如何省略特定对象类型的视图模式下的显示。

    To set a Detail View's display mode, use the DetailView.ViewEditMode property. To change this property value, implement a View Controller and override the OnActivated method.

    要设置详细视图的显示模式,请使用"明细视图.ViewEditMode"属性。要更改此属性值,实现视图控制器并重写 OnAndonon 方法。

    using DevExpress.ExpressApp.Editors;
    //...
    public class SwitchToEditModeModificationsController : ViewController<DetailView> {
        protected override void OnActivated() {
            base.OnActivated();
            if (View.ViewEditMode == ViewEditMode.View) {
                View.ViewEditMode = ViewEditMode.Edit;
                ObjectSpace.SetModified(null);
            }
        }
    }

    To accomplish the implemented code when the current View represents an object of a particular type, set the ViewController.TargetObjectType property to this type in the View Controller's constructor. As an example, assume that the Controller is intended for Person type objects.

    要在当前视图表示特定类型的对象时完成实现的代码,请将 ViewController.TargetObjectType 属性设置为视图控制器的构造函数中的此类型。例如,假设控制器适用于 Person 类型对象。

    public SwitchToEditModeModificationsController() {
        TargetObjectType = typeof(Person);
    }

    If you now run the application, you will see that the Person Detail View is always displayed in edit mode.

    如果现在运行该应用程序,您将看到"人员详细信息"视图始终以编辑模式显示。

    Note 注意
    The View Controller demonstrated in this topic should be implemented in an ASP.NET module. In Windows Forms applications, Detail Views are always editable.
    本主题中演示的视图控制器应在ASP.NET模块中实现。在 Windows 窗体应用程序中,详细信息视图始终可编辑。
  • 相关阅读:
    通过数据归一化提高WPF绘图效率
    WPF 利用路径动画做一个环形加载动画
    WPF 实现简易事件聚合
    WPF 使用渐变色在绘图中灵活应用
    WPF 使用DrawingVisual和DispatchFrame快速提升绘图速度
    本地Nuget包管理
    飞腾芯片 中标麒麟 安装mysql
    飞腾平台 银河麒麟 安装nginx
    mysql8的配置优化
    国产化之路-国产操作系统安装.net core 3.1 sdk
  • 原文地址:https://www.cnblogs.com/foreachlife/p/How-to-Display-a-Detail-View-Directly-in-Edit-Mode-in-ASP-NET-Applications.html
Copyright © 2011-2022 走看看