|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
inserting a row in datasetHi,
Lets say I have 3 rows in a dataset bound to a datatgrid. Now I want to add a new blank row before the second row in the dataset. How am I going to do that? I think there was an insertat method of dataset that I tried but wasnt working correctly. A short working code will help. I'm doing this in vs.net 2k3. Thanks, Ab. I recommend you post ADO.NET questions in the ADO newsgroup.
In any case, I have found this to be buggy. The problem is that the DataView does not refresh itself with the correct row positioning. No matter where you add the row, it shows up at the end of the list, even though in the underlying DataTable it is in the right spot. And whenever you bind to a datatable, you are really binding to its DefaultView property which is a DataView. Now, I think I remember there being some sort of argument that this is by design - but I just don't get it. If I add a row in the middle, I expect the DataView to refresh itself. Your options are to create a brand new DataView after the insert and bind to that. Or, to not use the dataset as a datasource and to write your own collection you can bind to (ok, this could turn into a lot of work). And the last option is to not allow the user to insert rows in the middle. Show quoteHide quote "Abubakar" <abubak***@gmail.com> wrote in message news:eQ0KBSoEGHA.3384@TK2MSFTNGP12.phx.gbl... > Hi, > Lets say I have 3 rows in a dataset bound to a datatgrid. Now I want to > add > a new blank row before the second row in the dataset. How am I going to do > that? I think there was an insertat method of dataset that I tried but > wasnt > working correctly. A short working code will help. > > I'm doing this in vs.net 2k3. > > Thanks, > > Ab. > >
Other interesting topics
HttpWeb Request from Class Library fails to 500
How do I convert a DataSet to a String from a WebService when debugging long delay before hitting breakpoint in page load Don't show page in browser history Calendar Control asp.net 2.0 caching GridView and XML problems ASP.net 2.0 GridView edit mode problems Switching from http to https and back What is ASPNETDB.MDF used for? |
|||||||||||||||||||||||