Library tutorials & articles
Web Forms DataGrid and DataSet Programming
Introduction
This is a working C# .NET program that demonstrates how to integrate most of the features of the DataGrid and DataSet in a single project including select, insert, update, delete, confirm delete, sort, filter and page. This is a work in progress and feedback is an important factor in improving this tutorial. Please report any bugs and I will try to fix them.
A few general concepts are presented here and represent my best understanding of how the DataSet and DataGrid works.
The SqlDataAdapter provides a bridge between the DataSet and the data source.
Calling Fill, refreshes the data in the DataSet. Calling Update, attempts to
commit any changes in the DataSet. The SqlDataAdapter wizard simplifies building
of data driven forms by automatically generating UPDATE, INSERT and DELETE statements from your SqlDataAdapter SELECT statement. By default, the UPDATE statement implements an Optimistic Concurrency scheme that looks for an unaltered
row on UPDATE.
The DataSet can encapsulate a parent child hierarchy of zero or more data
tables. The DataSet also stores its state, storing both the @original values
and any new uncommitted values. These original values are used to enforce "Optimistic
Concurrency" by searching for unaltered rows on UPDATE. Unlike the DataGrid,
the DataSet does _not_ persist itself on post back.
The DataGrid is used to display data in the HTML page. If DataGrid paging is not enabled, the DataGrid will display all of the rows in the appropriate table in the corresponding DataSet. To enable sorting and filtering, the DataGrid is bound to a View, not to the DataSet.
The View is used to sort and filter data in the DataSet before it is passed to the DataGrid using the properties:
view.RowFilter
view.Sort
The data path looks like this:
DataBase --> DataSet --> View --> DataGrid
Related articles
Related discussion
-
Tramadol without doctor rx. Buy Tramadol over the counter cod overnight. Cheap Tramadol cod delivery. Buy Tramadol from mexico online.
by Italosa (107 replies)
-
How to purchase Adipex online. Buy cheap Adipex. Cheap Adipex prescriptions. Adipex no script required express delivery.
by jimtaylor (11 replies)
-
Buy Meridia with no prescription. Buy Meridia cod delivery. Cheap Meridia no rx. No prescription required Meridia.
by jimtaylor (13 replies)
-
Buy Soma online without a prescription. Soma drug no prescription. How to get Soma prescription. Soma cod accepted.
by jimtaylor (34 replies)
-
Not expensive order prescription Diazepam. Overnight delivery of Diazepam in US no prescription needed. Buy generic Diazepam. Cheap Diazepam no prescription next day delivery.
by jimtaylor (16 replies)
Related podcasts
-
Writing FaceBook Applications with .NET - Interview with Mel Sampat, author of Outsync
In this episode, Scott talks with Mel Sampat, a Program Manager at Microsoft who's written OutSync, an application that syncs faces between Outlook, Facebook, and indirectly Windows SmartPhones. They chat about what it takes to write your own FaceBook application using ASP.NET or WinForms.
Events coming up
-
Mar
25
Hyper-V For Developers with Liam Westley
Bristol, United Kingdom
Liam Westley returns to Bristol fresh from his DDD8 exploits to give us a second dose of virtualization, this time focussing on Hyper-V.
Vjero
hi
hey ppl i m inserting some data manually in a dataview then i m sorting that dta via dataview.sort , sorting is taking place perfectly here but when i embed this data into a word document then i found that data is not in sorted order as this supposed to be but it is in order in which it had typed...........so guys if u have have any solution of this problem then plz mail me at aman_105@rediffmail.com
hello
I am converting C#.net code into vb.net code .
Sorting ASC or DESC is not working .
while degugging ,code work fine but i think some how dataset is not getting refreshed.
I have commented these line 'view.RowFilter = lastFilter' .Is it require for sorting
Execpt that everything is same
please help me out .
Thanks
Hi.
I dont know if this only a problem of mine, but when I hit a sort column the DataGridSortCommand happens twice.
Should this happen? In my case it happens and so all the code in that event doesnt work properly...
Could some help me out on this one?
TIA,
C.C.
Jeff,
Thanks a bunch! I am new to ASP.NET programming and it was having a devil of a time getting my datagrid to sort -- your example provided the one missing link: the DataSource property should have been set to the view and not the dataset! Tanx again.
--Babak
This thread is for discussions of Web Forms DataGrid and DataSet Programming.