C# .NET - what is DataView?what is use of it? - Asked By swati deshpande on 24-Feb-06 05:37 AM

CAN ANY ONE SEND ME THE PURPOSE & USE OF DATAVIEW IN ASP.NET USING C#.
ANY HELP IS APPRITIABLE, THANX IN ADVANCE.

A DataView is a collection - Asked By Peter Bromberg on 24-Feb-06 06:39 AM

of DataRowView objects, each representing a row in a DataTable. DataRowViews are used for sorting and filtering. Every DataTable has an automatic DataRowView property, "DefaultView".

DataView - Asked By Shallu Gupta on 24-Feb-06 06:44 AM

You can releate DataView as Views in Database where we can restrict the columns, can specify the filter criteria and sorting criteria.
This article will help you clear your doubts ablout DataView.
http://www.asp101.com/articles/stuart/dataview/default.asp

here are some imp points - Asked By Venkat K on 24-Feb-06 07:16 AM

if you want to see some advantages with dataview see this link
http://msdn.microsoft.com/msdnmag/issues/02/12/CuttingEdge/default.aspx
There are two ways to create a DataView. You can use the DataView constructor, or you can create a reference to the DefaultView property of the DataTable.
The following code example demonstrates how to create a DataView using the DataView constructor. A RowFilter, Sort column, and DataViewRowState are supplied along with the DataTable.
[CODE]
DataView custDV = new DataView(custDS.Tables["Customers"],
"Country = 'USA'",
"ContactName",
DataViewRowState.CurrentRows);
[/CODE]
The following code example demonstrates how to obtain a reference to the default DataView of a DataTable using the DefaultView property of the table.
[CODE]
DataView custDV = custDS.Tables["Customers"].DefaultView;
[/CODE]

Check this - Asked By mahesh pesani on 24-Feb-06 07:19 AM

Hi,
By using the dataview u can do the sorting, finding and filtering of the data.
A DataView enables you to create different views of the data stored in a DataTable, a capability that is often used in data-binding applications. Using a DataView, you can expose the data in a table with different sort orders, and you can filter the data by row state or based on a filter expression.
A DataView provides a dynamic view of data whose content, ordering, and membership reflect changes to the underlying DataTable as they occur. This is different from the Select method of the DataTable, which returns a DataRow array from a table per a particular filter and/or sort order and whose content reflects changes to the underlying table, but whose membership and ordering remain static. The dynamic capabilities of the DataView make it ideal for data-binding applications.
A DataView provides you with a dynamic view of a single set of data to which you can apply different sorting and filtering criteria, similar to the view provided by a database. However, a DataView differs significantly from a database view in that the DataView cannot be treated as a table and cannot provide a view of joined tables. You also cannot exclude columns that exist in the source table, nor can you append columns, such as computational columns, that do not exist in the source table.
http://msdn.microsoft.com
thnkx,
pesani

When we show our record in a DataGrid, then if we want to show our record with a specific condition or in a specific order then here we have to use DataView and its property. Let see with this programme how we can use DataView and its properties.