473,412 Members | 2,142 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Two DataGrids, same DataSource

I have to DataGrids each sharing the same DataSource. The user wants to be
able to select a different row in each grid but since they share the same
source when a row is selected in one grid the same row gets selected in the
other grid.

I'd rather not have two seperate sources containing the same data since
there is often many thousands of rows.

Is there any way around this?

--

Cheers,

elziko
Nov 20 '05 #1
10 1324
Hi Elziko,

I never did this, however did you try it with a copy of your dataset
dim mynewdataset = myolddataset.copy

http://msdn.microsoft.com/library/de...scopytopic.asp

I hope this helps?

Cor
Nov 20 '05 #2
Create a dataview for each one, even if it's the same table... then bind
each grid to the different dataview.
"elziko" <el****@NOTSPAMMINGyahoo.co.uk> wrote in message
news:Oy**************@TK2MSFTNGP10.phx.gbl...
I have to DataGrids each sharing the same DataSource. The user wants to be
able to select a different row in each grid but since they share the same
source when a row is selected in one grid the same row gets selected in the other grid.

I'd rather not have two seperate sources containing the same data since
there is often many thousands of rows.

Is there any way around this?

--

Cheers,

elziko

Nov 20 '05 #3
> I never did this, however did you try it with a copy of your dataset
dim mynewdataset = myolddataset.copy


As I said I'd rather not have two seperate sources containing the same data
since
there is often many thousands of rows because this would be a waste of
memory.

--

Cheers,

elziko
Nov 20 '05 #4
Thanks!
Create a dataview for each one, even if it's the same table... then bind
each grid to the different dataview.


I have tried creating two view each based onthe same table. This works but
now when I select a row in the second grid, for example, the same row gets
selected in the first grid. So its really the same problem as before.

Any idea how to stop this?

--

Cheers,

elziko
Nov 20 '05 #5
Hi,

I saw the answer from Bill and than I knew it again, however why to answer
that again.

Cor
Nov 20 '05 #6
There are two different views and the grids are both bound to seperate ones?
"elziko" <el****@NOTSPAMMINGyahoo.co.uk> wrote in message
news:#x*************@TK2MSFTNGP10.phx.gbl...
Thanks!
Create a dataview for each one, even if it's the same table... then bind
each grid to the different dataview.


I have tried creating two view each based onthe same table. This works but
now when I select a row in the second grid, for example, the same row gets
selected in the first grid. So its really the same problem as before.

Any idea how to stop this?

--

Cheers,

elziko

Nov 20 '05 #7
I realize you mean the pointer when you say selected, not the entire row in
the grid being selected like when you click on it. Since it's a reference
type, I don't think you can do it without making a seperate copy.
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
There are two different views and the grids are both bound to seperate ones? "elziko" <el****@NOTSPAMMINGyahoo.co.uk> wrote in message
news:#x*************@TK2MSFTNGP10.phx.gbl...
Thanks!
Create a dataview for each one, even if it's the same table... then bind each grid to the different dataview.


I have tried creating two view each based onthe same table. This works but now when I select a row in the second grid, for example, the same row gets selected in the first grid. So its really the same problem as before.

Any idea how to stop this?

--

Cheers,

elziko


Nov 20 '05 #8
Like I mentioned in my last post, you'll probably need to make a second
copy. However, you can use one adapter to fill each datatable, and use the
same adapter to update the datatables. I don't know the whole scenario, but
you could make this work fairly easily.
"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
There are two different views and the grids are both bound to seperate ones? "elziko" <el****@NOTSPAMMINGyahoo.co.uk> wrote in message
news:#x*************@TK2MSFTNGP10.phx.gbl...
Thanks!
Create a dataview for each one, even if it's the same table... then bind each grid to the different dataview.


I have tried creating two view each based onthe same table. This works but now when I select a row in the second grid, for example, the same row gets selected in the first grid. So its really the same problem as before.

Any idea how to stop this?

--

Cheers,

elziko


Nov 20 '05 #9
Yes I have it running OK but since I have two data tables its double the
memory and on computers with only a little RAM it runs very slowly. I'll
just have to live with it or change it so only one grid is visible at a time
(then I'll just need one drid & one data table).

--

Cheers,

elziko
Nov 20 '05 #10
This should solve your problem:

DataGrid1.DataSource = MyDataSet
DataGrid1.DataMember = "Table"

'second grid needs its own BindingContext
DataGrid2.BindingContext = New BindingContext
DataGrid2.DataSource = MyDataSet
DataGrid2.DataMember = "Table"
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: msnews.microsoft.com | last post by:
I am new to C# (coming from java) and I am confused about how to properly work with datagrids. The application I am working on is a message based system where properties aren't changed in direct...
1
by: Simon Harris | last post by:
Hi All, I wish to populate more than one datagrid from the same OleDBCommand. The code I have is: Dim objCmd As New OleDbCommand(strSql, objConn) Then... ...
1
by: Chris | last post by:
Hi, I have the following dataset Loc Qty Amt OH 5 2 NC 4 1 OH 2 4 I have two datagrids on the same page one for OH and the other for NC. Is it possible to select only OH rows from one...
7
by: erniej | last post by:
as per instructions in the walkthrough, I have managed to create a master/detail relationship between two datagrids. However I have a requirement to apply this to three datagrids and the third...
1
by: Engineerik | last post by:
dfjhsqd asked this earlier in the week and I have the same question. How can I apply a filter to the Master table when using two datagrids in a MasterDetail relationship?
3
by: anon | last post by:
I want to obtain the appearance of frozen columns as in an excel sheet so thet the first two columns of the table remain in view at all times. Example - I have a table of products - listed by...
4
by: mark | last post by:
(windows app not web) I have a procedure to populate a given datagrid (Datagrid1) with a dataset from an indexed data connection. It works: Globals: Dim FileName1 As String Dim DS As...
1
by: tomb | last post by:
This is making me crazy! vb.net 2003 I have two datagrids, datasource is the same datatable. I need the first one to show only 2 columns, the second to show 99 columns. They also have to be in...
1
by: Gary200 | last post by:
Hello All, I bind two datagrids in a master-detail relationship successfully. What I want is to set allowNew and allowDelete disabled in both datagrid using dataview. The code like this: ...
0
by: Jim | last post by:
OK here's my disclaimer: I'm very new to ASP.NET and posting on Google Groups, so please bear with me and feel free to correct either the way I code or the way I post. I have an ASP.NET page...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.