C#
I have a screen with 2 datagrids on it. The screen is designed for
allocating records from one datagrid to the other. Once a record has moved
from one to the other, i refresh them both to show the change. To do the
refresh though, currently I am sending a request back to the DB to refetch
the records, which can obviously have performance hits.
I have been able to refresh the datagrid which is losing the record, by
creating a new dataset, merging the old data into it, and then removing the
relevant row from this dataset before rebinding the grid to it:
dsData topGridDS = new dsData();
topGridDS.Merge(initialTopDS.Job);
topGridDS.Job.Rows.Remove(topGridDS.Job.FindByJobI D(....))
datagrid1.datasource = topGridDS...
....
...
so this refreshes the datagrid that is losing a row, without going back to
the DB to refresh. But how do I do the reverse process, of adding the moved
row into a new dataset? If I use the AddRow method it complains that the row
already belongs to a dataset. I thought maybe I could use the CopyTo method
but I cant work out how to use that either.
Thanks
Steve 1 1285
Use the ItemArray of the original DataRow to get the data in it, and then
use the same ItemArray to fill a new row in the receiving table.
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"Steve" <St***@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com... C#
I have a screen with 2 datagrids on it. The screen is designed for allocating records from one datagrid to the other. Once a record has moved from one to the other, i refresh them both to show the change. To do the refresh though, currently I am sending a request back to the DB to refetch the records, which can obviously have performance hits.
I have been able to refresh the datagrid which is losing the record, by creating a new dataset, merging the old data into it, and then removing the relevant row from this dataset before rebinding the grid to it:
dsData topGridDS = new dsData();
topGridDS.Merge(initialTopDS.Job);
topGridDS.Job.Rows.Remove(topGridDS.Job.FindByJobI D(....))
datagrid1.datasource = topGridDS... ... ..
so this refreshes the datagrid that is losing a row, without going back to the DB to refresh. But how do I do the reverse process, of adding the moved row into a new dataset? If I use the AddRow method it complains that the row already belongs to a dataset. I thought maybe I could use the CopyTo method but I cant work out how to use that either.
Thanks
Steve
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alpha |
last post by:
I have a small Window application and through out the different forms I
create a different dataset. At the begining I used the Tools to drag and
drop the SqlDataAdapter, connection and dataset...
|
by: GaryDean |
last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much
in answers so I'm reposting some questions posted by some of the programmers
here in our organization that never got...
|
by: Luqman |
last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ?
Best Regards,
Luqman
|
by: Ronald S. Cook |
last post by:
I've always used untyped datasets. In a Microsoft course, it walks through
creating typed datasets and harps on the benefits. It has you drag all
these things around ..wizard, wizard, wizard......
|
by: Don Miller |
last post by:
In my migration from ASP to ASP.NET 2.0, I have a fair number of complicated
HTML tables that defy anything .NET can do. Using classic ASP I created
these tables (by string concatenation) by moving...
|
by: Penelope Dramas |
last post by:
Hello,
I'm in a front of very serious .net redesign/rewrite of an old VB6
application.
I had been asked to make it .NET 2.0 and would like to ask couple of
questions regarding data access as...
|
by: Chris Asaipillai |
last post by:
Hi there
I have some questions for those experienced Visual Basic 6 programmers out
there
who have made the transition from VB6 to Vb.net.
How long did it take you to learn at least the basic...
|
by: S.Tedeschi |
last post by:
Hi all;
as posted some days ago, I'm converting an on-line app; I used to
heavily rely on strongly-typed DataSets directly dropped onto pages,
and so viewed by code(-behind) as well. In the next...
|
by: BillE |
last post by:
I'm trying to decide if it is better to use typed datasets or business
objects, so I would appreciate any thoughts from someone with more
experience.
When I use a business object to populate a...
|
by: gardnern |
last post by:
We have X number of data sets, of Y length each.
For example...
Small, Medium, Large
and
Red, Green, Blue, Yellow
We need to generate a list of all possibilities
Small Red
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |