本文介绍了GridView与System.ComponentModel的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我想在.Net中对GridView和其他控件进行一些澄清。 我正在玩GridView然后我遇到了 Hi,I want some clarification about GridView and other control in .Net.I was playing with GridView and then I came acrossprotected void gvDetails_RowEditing(object sender, GridViewEditEventArgs e)"。 我右键单击 GridViewEditEventArgs e 在其类实现中使用 System.ComponentModel 查看其定义并找到命名空间。 我的问题是 - GridView a ComponentModel ? 如果没有,它必须对组件做什么吗? 什么是 COM 对象?它和asp.net控件(按钮,下拉)之间是否有任何关系? 提前致谢 on server side code.I right click to GridViewEditEventArgs e to see its definition and found namespace using System.ComponentModel in its class implementation. My Question is that -Is GridView a ComponentModel ? and if not does it has to do anything with Component? What is COM object ? Is there any relation between it and asp.net control(button, drop down)etc ? Thanks in advance推荐答案 引用:在表中显示数据源的值,其中每列表示一个字段,每行代表一条记录。 GridView 控件使您可以选择,排序和编辑这些项目。 Displays the values of a data source in a table where each column represents a field and each row represents a record. The GridView control enables you to select, sort, and edit these items.System.Object System.Web.UI.Control System.Web.UI.WebControls.WebControl System.Web.UI.WebControls.BaseDataBoundControl System.Web.UI.WebControls.DataBoundControl System.Web.UI.WebControls.CompositeDataBoundControl System.Web.UI.WebControls.GridView GridViewEditEventArgs Class [ ^ ]。 GridViewEditEventArgs Class[^]. Quote:提供 RowEditing event。 Provides data for the RowEditing event.System.Object System.EventArgs System.ComponentModel.CancelEventArgs System.Web.UI.WebControls.GridViewEditEventArgs System.ComponentModel System.ComponentModel命名空间 [ ^ ]。 System.ComponentModel Namespace[^].引用: 系统.ComponentModel namespace提供了用于实现组件和控件的运行时和设计时行为的类。此命名空间包括用于实现属性和类型转换器,绑定到数据源和许可组件的基类和接口。The System.ComponentModel namespace provides classes that are used to implement the run-time and design-time behavior of components and controls. This namespace includes the base classes and interfaces for implementing attributes and type converters, binding to data sources, and licensing components. 从上面我可以理解的是 GridView 是一个 Web UI控件,因为它来自命名空间 System.Web.UI.Control 。 因此, GridView 不是 ComponentModel (其中 GridViewEditEventArgs 派生自命名空间 System.ComponentModel.CancelEventArgs ,所以事件以这种方式与 System.ComponentModel 类有关。 这个 ComponentModel 类提供类 CancelEventArgs Class [ ^ ],其中last为可取消的事件提供数据。 From the above, what I can understand is that The GridView is a Web UI Control as it is derived from Namespace System.Web.UI.Control. Thus, GridView is not a ComponentModel (which was one of your questions).The GridViewEditEventArgs is derived from Namespace System.ComponentModel.CancelEventArgs, so the event has relation with System.ComponentModel class in this way.This ComponentModel class provides class CancelEventArgs Class[^], which at last provides data for a cancelable event. Ramesh问:什么是在当前场景中使用COM对象..?What is the use of COM object in present scenario..?没有这样的角色。为什么? ASP.NET只不过是HTTP服务器的插件(HTTP服务器的术语通常用术语模块),它以编程方式处理一些HTTP请求并生成HTTP响应。 ASP.NET控件只不过是HTTP控件和其他元素的包装器。 另一方面,COM是非复杂的解决方案OOP OS(更确切地说是OS API;例如,Windows在其内部设计中本质上是面向对象的,但它暴露非OOP API,支持使用非OOP语言进行开发),旨在增加对OOP编程的支持,以及重要的是,要恢复语言和系统之间的兼容性,这在不同雄心勃勃的公司,组织和不想达成协议的团队之间的竞争中基本上会丢失。换句话说,它被设计成一些拐杖来修复跛脚。 由于.NET最初被设计为OOP平台,而非OOP语言完全脱离了图片,它不需要这样的拐杖。 COM仍在内部用于与某些OS组件接口并向开发人员公开,也是出于兼容性原因而使用。为什么在ASP.NET中需要这样的垃圾?没有理由。 -SA There is no such role. Why?ASP.NET is nothing but a plug-in for the HTTP server (HTTP server''s terminology more usually operates the term "module") which programmatically handles some HTTP requests and generate HTTP responses. The ASP.NET controls are no more than wrappers of HTTP control and other elements.COM, from the other hand, is a sophisticated work-around of the non-OOP OS (more exactly OS APIs; for example, Windows is inherently object-oriented in its internal design, but it exposed non-OOP API, to support development with non-OOP languages), designed to add the support for OOP programming, and, importantly, to restore the compatibility between languages and system, which was essentially lost in competition between different ambitious companies, organizations and teams who did not want to get into agreements. In other words, it was designed as some crutches to fix the lameness.As .NET was originally designed as OOP platform, and non-OOP languages are completely out of the picture, it does not need such crutches. COM is still used internally to interface with some OS component and exposed to the developer, also to be used for compatibility reasons. Why would such trash be ever needed in ASP.NET? No reasons.—SA 这篇关于GridView与System.ComponentModel的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-09 23:32