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 窗体应用程序中,详细信息视图始终可编辑。
  • 相关阅读:
    ajax提交请求返回对象异常问题
    Rhino+envjs-1.2.js 在java运行网站js 工具类
    CryptoJS遇到的小坑
    BT是如何下载的
    NPOI 复制Word中的表格内容, 操作Word表格
    使用Scapy框架进行PPPOE拨号密码截取
    用Python养一只DHT爬虫
    如何解决jquery版本冲突
    安装ECMall后报PHP Strict Standards错误,请问如何解决
    如何在Webstorm/Phpstorm中设置连接FTP,并快速进行文件比较,上传下载,同步等操作(远程开发)
  • 原文地址:https://www.cnblogs.com/foreachlife/p/How-to-Display-a-Detail-View-Directly-in-Edit-Mode-in-ASP-NET-Applications.html
Copyright © 2011-2022 走看看