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 窗体应用程序中,详细信息视图始终可编辑。
  • 相关阅读:
    jQuery链式编程时修复断开的链
    只是一个用EF写的一个简单的分页方法而已
    asp.net Core 获取应用程序所在目录的2种方式
    FineUI使用记录
    C#判断一个string是否为数字
    MVC中利用ViewBag传递Json数据时的前端处理方法
    基于Ajax的文件上传使用FileInput插件(使用谷歌翻译作者的原文,大致意思是对的,自己把握)
    ansible中tag的用法
    rabbitMQ中vhost虚拟主机的理解
    一些比较好的链接
  • 原文地址:https://www.cnblogs.com/foreachlife/p/How-to-Display-a-Detail-View-Directly-in-Edit-Mode-in-ASP-NET-Applications.html
Copyright © 2011-2022 走看看