PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Master Detail with two DataGrids

Reply

Master Detail with two DataGrids

 
Thread Tools Rate Thread
Old 04-11-2003, 08:24 PM   #1
Mauricio
Guest
 
Posts: n/a
Default Master Detail with two DataGrids


I have a form with 2 DataGrids.
The first is bound with a parent table and the second is
bound with a child table. The update and delete rules of
the relation are Cascade.
When I change a parent's key column value and after I
click on the child DataGrid, the child DataGrid becomes
empty. Now, if I changed the parent's key column value and
click on another parent's row and after click on child
DataGrid, it's ok.
What do I need to do?

  Reply With Quote
Old 05-11-2003, 12:51 PM   #2
Ying-Shen Yu[MSFT]
Guest
 
Posts: n/a
Default RE: Master Detail with two DataGrids

Hi Mauricio,
I can repro your problem, it seems the key value in the child datagrid
didn't get updated after the key value changed,I'm researching on it to see
if there is a work around to this. I'll update this issue as soon as I get
some result.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

  Reply With Quote
Old 07-11-2003, 01:46 AM   #3
Ying-Shen Yu[MSFT]
Guest
 
Posts: n/a
Default RE: Master Detail with two DataGrids

Hi Mauricio,

I'm still researching on your problem, it seems the child datagrid didn't
get updated correctly, if you call the Refresh method of the parent table's
currency manger, the child datagrid will show data correctly. I'm now
involving more people on this issue, I appreciate you patience when we look
into it, I'll reply to this thread as soon as I have some update to you.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

  Reply With Quote
Old 07-11-2003, 05:30 AM   #4
Ying-Shen Yu[MSFT]
Guest
 
Posts: n/a
Default RE: Master Detail with two DataGrids

Hi Mauricio,
You may get around this problem follow this KB article:
<BUG: A New Record That Is Added to a Parent DataGrid Control Does Not
Populate the Foreign Key Column in the Child DataGrid Control>
http://support.microsoft.com/?id=816227
This article is for adding a new record case, but as my test, the work
around also applies for modifying a primary key column.
Does it solve your problem?

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

  Reply With Quote
Old 07-11-2003, 05:44 AM   #5
Ying-Shen Yu[MSFT]
Guest
 
Posts: n/a
Default RE: Master Detail with two DataGrids

Here is some code snippet, I hope it's helpful to you.
<code>
private void Form1_Load(object sender, System.EventArgs e)
{
oleDbDataAdapter2.Fill(dataSet11);
oleDbDataAdapter1.Fill(dataSet11);
dataSet11.Tables["ParentTableName"].RowChanged += new
DataRowChangeEventHandler(Form1_RowChanged);
}

private void Form1_RowChanged(object sender, DataRowChangeEventArgs e)
{
// Get the Currency Manager
CurrencyManager myCurrencyManager =
(CurrencyManager)this.BindingContext[dataSet11, "ParentTableName"];
// Refresh the Currency Manager
myCurrencyManager.Refresh();
}
</code>
Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

  Reply With Quote
Old 07-11-2003, 04:36 PM   #6
Mauricio
Guest
 
Posts: n/a
Default RE: Master Detail with two DataGrids

Hi Ying-Shen Yu [MSFT],
This code resolved the problem.
Thanks.
Best Regards,

Mauricio (Brazil)
ControlBase - Automation Systems

>-----Original Message-----
>Here is some code snippet, I hope it's helpful to you.
><code>
>private void Form1_Load(object sender, System.EventArgs e)
>{
> oleDbDataAdapter2.Fill(dataSet11);
> oleDbDataAdapter1.Fill(dataSet11);
> dataSet11.Tables["ParentTableName"].RowChanged +=

new
>DataRowChangeEventHandler(Form1_RowChanged);
>}
>
>private void Form1_RowChanged(object sender,

DataRowChangeEventArgs e)
>{
> // Get the Currency Manager
> CurrencyManager myCurrencyManager =
>(CurrencyManager)this.BindingContext

[dataSet11, "ParentTableName"];
> // Refresh the Currency Manager
> myCurrencyManager.Refresh();
>}
></code>
>Best regards,
>
>Ying-Shen Yu [MSFT]
>Microsoft Online Partner Support
>Get Secure! - www.microsoft.com/security
>
>This posting is provided "AS IS" with no warranties and

confers no rights.
>You should not reply this mail directly, "Online" should

be removed before
>sending, Thanks!
>
>.
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off