Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 28-Feb-12 23:36pm
v2
Comments
Shahin Khorshidnia 29-Feb-12 5:39am    
Maybe it helps:

http://msdn.microsoft.com/en-us/library/system.web.ui.datasourceview.aspx
ZurdoDev 29-Feb-12 8:15am    
You can read what it is online, but why do you need to know? What is the real question?
[no name] 29-Feb-12 8:49am    
It doesn't matter why the OP wants to know this. The question is valid, your comment is not.
ZurdoDev 29-Feb-12 8:52am    
You're right, asking why they want to know and what the real question is, is inappropriate. Thanks.

1 solution

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)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900