什么是asp.net中的GetData方法 [英] what is GetData method in asp.net

查看:182
本文介绍了什么是asp.net中的GetData方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

asp .net中的GetData方法是什么?当我在micorosoft网站上搜索时,我得到了类似的东西,但我没有得到. "GetData方法通过调用GetDataSource方法从关联的数据源控件中检索DataSourceView对象.
什么是DataSource View?返回什么?以及来自哪个关联的数据源

这是链接 http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.databoundcontrol.getdata.aspx [

what is GetData method in asp .net? when i searched on micorosoft website i got something like this which i didnt get . " The GetData method retrieves a DataSourceView object from the associated data source control by calling the GetDataSource method. "

what is DataSource View ?what does it returns ?? and from which associated data source

here is the link http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.databoundcontrol.getdata.aspx[^]
a simple eg of GetData would be helpful

thanks
anoop

推荐答案

问题隐含了自定义数据绑定控件的必要性.创建自定义数据绑定控件时,必须实现数据绑定功能. DataBoundControl,GetData(),DataSourceView和GetDataSource()是自定义数据绑定控件中涉及的一些方法和类.

DataBoundControl 是用于实现自定义数据绑定控件的基类.它包含方法,例如 GetDataSource()来帮助自定义控件的数据绑定实现.

根据定义,数据绑定控件将需要绑定到数据.关于数据,有一个重要的问题要回答:什么是数据?它是文件吗?它是数据库中的表吗?如果是文件,则采用什么格式:CSV,XML,文本,pdf?它是相关数据的集合还是单个数据?知道什么是原始数据;它的结构;其格式;必须使用它作为自定义控件的数据源的基础数据.

数据绑定控件将需要一个数据源.数据源通常由控件的用户设置.数据源可以是以前暗示的文件和数据库实体之类的东西.在自定义控件中使用绑定时,可以通过调用GetData()访问数据. GetData方法在内部调用GetDataSource().调用这些方法将检索由DataBoundControl对象缓存的 IDataSource 实例.该实例将一直保留,直到 OnDataPropertyChanged 方法发出信号表明数据源已更改.

具体来说,GetData()返回 DataSourceView . DataSourceView是基类,由控件用于数据操作.创建自定义数据绑定控件可能会涉及到创建自定义DataSourceView. DataSourceView提供创建,读取,更新和删除(CRUD)操作,以处理基础原始数据.相应的方法是:插入,选择,更新和删除.在某种程度上,DataSourceView为数据绑定控件提供了数据结构.因此,原始数据有三种表示形式:原始数据结构本身(XML,数据库表),DataSourceView(提供给控件的结构)和数据绑定控件(控件呈现控件的方式).数据发送给用户).

注意:请查看上面提供的链接,以获取相应主题的用法示例(最值得注意的是, DataBoundControl )
The question implies the necessity of a custom data-bound control. When creating a custom data-bound control, the data-binding abilities must be implemented. DataBoundControl, GetData(), DataSourceView, and GetDataSource() are a few methods and classes involved in custom data-bound controls.

DataBoundControl is the base class used to implement custom data-bound controls. It contains methods such as GetData() and GetDataSource() to help with the data-binding implementation of the custom control.

A data-bound control by definition will need to bind to data. There is one important question to answer regarding data: What is the data? Is it a file? Is it a table in a database? If it is a file, what format is it in: CSV, XML, text, pdf? Is it a collection of related data or a single piece? Knowing what the raw data is; its structure; its format; is essential to be able to use it as the underlying data for the data source of the custom control.

A data-bound control will need a data source. The data source is generally set by the user of the control. The data source can be such things as files and database entities as previously implied. When working with binding in the custom control the data is accessed by calling GetData(). The GetData method calls GetDataSource() internally. Calling these methods retrieves an IDataSource instance that is cached by the DataBoundControl object. This instance will remain until the OnDataPropertyChanged method signals that the data source has changed.

Specifically, GetData() returns a DataSourceView. The DataSourceView is a base class and is used by the control for data operations. Creating a custom data-bound control will probably involve creating a custom DataSourceView. A DataSourceView provides create, read, update, and delete (CRUD) operations for working with the underlying raw data. The corresponding methods are: Insert, Select, Update, and Delete. In a way, the DataSourceView provides the structure of the data for the data-bound control. Therefore, there are three representations of the raw-data: the raw-data structure itself (XML, database table), the DataSourceView (the structure to provide to the control), and the data-bound control (the way the control presents the data to the user).

NOTE: Please view the links provided above for example usage of the corresponding topic (Most notably, DataBoundControl)


这篇关于什么是asp.net中的GetData方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆