Basic use of DataView
What is the basic use of dataview in ado.net?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kunal VaishyaPosted Oct 5, 2012, 7:43 AM
main benefit of dataview to filter records and do operation on you can also convert in to table or else
R ACHUTHAPosted Oct 5, 2012, 6:56 AM
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.
Dataview provides a dynamic view for a datatable. Using dataview we can perform following operation:
· Sorting the table
· Add, modify, delete the data
· Filtering data from table
Example:
Creating Dataview object as
Dataview dv=new Dataview();
How to use Sort property of Dataview
DataView dv = DataTable1.DefaultView;
dv.Sort = "username, email DESC";
Filtering in Dataview
DataView dv = new DataView(datatable1,"joindate >= 01/01/2010", DataViewRowState.CurrentRows);
refer the below link
http://www.c-sharpcorner.com/UploadFile/rohatash/ado-net-dataview-in-Asp-Net/