Questions tagged [dataview]

A dataview is a .net class which represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation. The DataView does not store data, but instead represents a connected view of its corresponding DataTable. Changes to the DataView’s data will affect the DataTable. Changes to the DataTable’s data will affect all DataViews associated with it.

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 in the underlying DataTable: the content, ordering, and membership reflect changes as they occur. This behavior differs from the Select method of the DataTable, which returns a DataRow array from a table based on a particular filter and/or sort order: thiscontent reflects changes to the underlying table, but its 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, much like a database view, to which you can apply different sorting and filtering criteria. Unlike a database view, however, a 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.

References

723 questions
61
votes
4 answers

Looping through rows in a DataView

The DataView object doesn't have a Rows property like DataTable. How do I loop through the rows of a DataView?
Alex Angas
  • 59,219
  • 41
  • 137
  • 210
45
votes
6 answers

How to use GWT 2.1 Data Presentation Widgets

At the 2010 Google IO it was announced that GWT 2.1 would include new Data Presentation Widgets. 2.1M is available for download, and presumably the widgets are included, but no documentation has yet surfaced. Is there a short tutorial or example for…
George Armhold
  • 30,824
  • 50
  • 153
  • 232
36
votes
3 answers

Read id3 v2.4 tags with native Chrome Javascript/FileReader/DataView

Based on the answer of ebidel, one can read id3v1 tags by using jDataView: document.querySelector('input[type="file"]').onchange = function (e) { var reader = new FileReader(); reader.onload = function (e) { var dv = new…
cocco
  • 16,442
  • 7
  • 62
  • 77
21
votes
2 answers

Easiest way to copy a dataview to a datatable in C#?

I need to copy a dataview into a datatable. It seems like the only way to do so is to iterate through the dataview item by item and copy over to a datatable. There has to be a better way.
Ravedave
  • 1,158
  • 2
  • 11
  • 24
21
votes
5 answers

C#: Custom sort of DataGridView

I need to sort a DataGridView with Natural Sorting (Like in Explorer) so that numbers and text (in the same column) are sorted naturally, and not alphabetically (so that "place 3" comes before "place 20", etc.). I have a DataGridView, where I have…
Svish
  • 152,914
  • 173
  • 462
  • 620
15
votes
3 answers

Compare dates in DataView.RowFilter?

I am scratching my head over something rather stupid yet apparently difficult. DataView dvFormula = dsFormula.Tables[0].DefaultView; dvFormula.RowFilter = "'" + startDate.ToString("yyyyMMdd") + "' < EndDate OR EndDate = '19000101'"; dvFormula.Sort =…
Peter
  • 14,221
  • 15
  • 70
  • 110
15
votes
5 answers

How to bind dataGridView predefined columns with columns from sql statement (without adding new columns)?

Is there a elegant way, to bind predefined dataGridView columns with results from a SQL statement? Example: dataGridView1.Columns.Add("EID", "ID"); dataGridView1.Columns.Add("FName", "FirstName"); Some SQL like SELECT t.FirstName AS FName, t.EmpID…
Jooj
  • 687
  • 4
  • 15
  • 32
13
votes
2 answers

Sorted dataview to datatable

I have the following method: private DataTable getsortedtable(DataTable dt) { dt.DefaultView.Sort = "Name desc"; //I would need to return the datatable sorted. } My issue is that I cannot change the return type of this method and I have to…
Sosi
  • 2,578
  • 8
  • 39
  • 49
13
votes
4 answers

How Can Convert DataRow to DataRowView in c#

Can or how to convert DataRow to DataRowView? For example: DataTable dt=ds.Tables[0]; DataRow dr= dt.NewRow(); DataRowView drv = ????
Harry Sarshogh
  • 2,137
  • 3
  • 25
  • 48
12
votes
1 answer

List to DataView

How to convert List to a dataview in .Net.
MAC
  • 6,277
  • 19
  • 66
  • 111
12
votes
3 answers

making rows distinct and showing all the columns

In my project there are two datatables dtFail and dtFailed (dtFailed has nothing but column names declarations). dtFail has duplicate "EmployeeName" column values. so i took a dataview dvFail and did the process to make them distinct as shown in the…
Mr_Green
  • 40,727
  • 45
  • 159
  • 271
12
votes
4 answers

Create ADO.NET DataView showing only selected Columns

In C# & .NET, can one create a DataView that includes only a proper subset of the DataColumns of a given DataTable? In terms of relational algebra, one assigns a RowFilter in order to perform a "selection" operation (σ). How would one perform a…
JaysonFix
  • 2,515
  • 9
  • 28
  • 28
11
votes
4 answers

Sorting a List by creation date C#

Using this example off MSDN: using System.Collections.Generic; using System.IO; namespace CollectionTest { public class ListSort { static void Main(string[] args) { List files = new…
JustAnotherDeveloper
  • 3,167
  • 11
  • 37
  • 68
10
votes
3 answers

How do I check for blank in DataView.RowFilter

Assuming I have a column called A and I want to check if A is null or blank, what is the proper way to check for this using the DataView's RowFilter: DataTable dt = GetData(); DataView dv = new DataView(dt); dv.RowFilter = "A IS NOT NULL OR A IS…
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
9
votes
4 answers

How to get a value from a column in a DataView?

I have a dataview defined as: DataView dvPricing = historicalPricing.GetAuctionData().DefaultView; This is what I have tried, but it returns the name, not the value in the column: dvPricing.ToTable().Columns["GrossPerPop"].ToString();
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
1
2 3
48 49