473,396 Members | 2,036 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,396 software developers and data experts.

binder.Current.row.rowstate not reflecting actual state of child row


I'm working through the binder stuff trying to get a handle on it...

I have setup a master-detail dataset and have a couple of textboxes from the
master along with a datadgrid for the child data.

I have a navigation pallete with the usual arrows. All arrow btn's are
handled by the same handler.

Before moving off the current record I do the following:

BindingContext(Me.DataSet11, "table2").EndCurrentEdit()

BindingContext(Me.DataSet11, "table1").EndCurrentEdit()

'deal with current row state 1st

checkRowState(sender, e)
CheckRowSTate looks at the rowstate and calls the SaveRecord routnine if
needed.
Select Case mbinder.Current.row.rowstate
Case DataRowState.Added

Call saveRecord()

Case DataRowState.Modified

Call saveRecord()

End Select

Select Case mbinder2.Current.row.rowstate

Case DataRowState.Added

Call saveRecord()

Case DataRowState.Modified

Call saveRecord()

End Select

The problem i'm having is this: after changing a value in the child
(datagrid) description field the rowstate remains unchanged on the 2nd or
greater master record. If I make a change to the child rec on the 1st
master the rowstate is 'modified' as expected.....

at this point i'm just bewildered.............
Nov 21 '05 #1
6 1768
Astro,

I am afraid that I don't understand your problem, however, a rowstate
reflects only the state of the changed datarow, where it is not important if
this is a child or a master.

To get more answers, I give you the advice to past in next time your code
first in a notebook copy it back and past it in a message. Now it is hard to
see in most newsreaders what your code looks like.

I hope this helps anyhow

Cor
Nov 21 '05 #2
Thanks Cor -- )

I am trying to trap state changes for a child table on a form when from
'unchanged' to 'modified' or 'added.' The code I am using does not do this.
I will repost it here:

form load:
========
cmT2 = CType(Me.BindingContext(Me.DataSet11.Tables!table2 ), CurrencyManager)
custom SaveRecord event:
===================

cmT2.EndCurrentEdit()

Select Case cmT2.Current.row.rowstate
Case DataRowState.Added
Stop
Case DataRowState.Modified
Stop
End Select
Before the postion changes on the form's master record, the 'saverecord'
code is called. When I make changes to the datagrid - which is populated by
the 'child' table and linked via the 'datamember' property using the
'table1table2' relation - and then move to another 'parent' record the
saveRecord event is called does not report an 'Added' or 'Modified' state in
the child table.

any ideas?


"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...
Astro,

I am afraid that I don't understand your problem, however, a rowstate
reflects only the state of the changed datarow, where it is not important
if this is a child or a master.

To get more answers, I give you the advice to past in next time your code
first in a notebook copy it back and past it in a message. Now it is hard
to see in most newsreaders what your code looks like.

I hope this helps anyhow

Cor

Nov 21 '05 #3
Hi,
[inline]

"astro" <as***@mnrr.com> wrote in message
news:Oj***************@tornado.rdc-kc.rr.com...
Thanks Cor -- )

I am trying to trap state changes for a child table on a form when from
'unchanged' to 'modified' or 'added.' The code I am using does not do
this. I will repost it here:

form load:
========
cmT2 = CType(Me.BindingContext(Me.DataSet11.Tables!table2 ),
CurrencyManager)
There is a chance you're getting the wrong CurrencyManager and so the wrong
Current DataRowView. You have to use the same DataSource/DataMember that
you used for binding to get the CurrencyManager.

Eg.:
detailGrid.DataSource = DataSet11
detailGrid.DataMember = "master_table.master_to_detail_relation"

cmT2 = DirectCast(BindingContext(DataSet11,
"master_table.master_to_detail_relation"), CurrencyManager)

A more generic way:
cmT2 = DirectCast(BindingContext(detailGrid.DataSource,
detailGrid.DataMember), CurrencyManager)

Also, if your detail table can contain multiple detail rows for each master
row, then you might want to use detailTable.GetChanges() or
detailTable.Select(), because the user could have changed multiple detail
rows before navigating master rows.

HTH,
Greetings



custom SaveRecord event:
===================

cmT2.EndCurrentEdit()

Select Case cmT2.Current.row.rowstate
Case DataRowState.Added
Stop
Case DataRowState.Modified
Stop
End Select
Before the postion changes on the form's master record, the 'saverecord'
code is called. When I make changes to the datagrid - which is populated
by the 'child' table and linked via the 'datamember' property using the
'table1table2' relation - and then move to another 'parent' record the
saveRecord event is called does not report an 'Added' or 'Modified' state
in the child table.

any ideas?


"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...
Astro,

I am afraid that I don't understand your problem, however, a rowstate
reflects only the state of the changed datarow, where it is not important
if this is a child or a master.

To get more answers, I give you the advice to past in next time your code
first in a notebook copy it back and past it in a message. Now it is hard
to see in most newsreaders what your code looks like.

I hope this helps anyhow

Cor



Nov 21 '05 #4
Astro,
Before the postion changes on the form's master record, the 'saverecord'
code is called.


How are you able to do that? (before)

Cor
Nov 21 '05 #5
ahhhhhhhhhhhh - I tried that before in a slighly different syntax and just
missed it.

Thanks !!

"Bart Mermuys" <bm*************@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi,
[inline]

"astro" <as***@mnrr.com> wrote in message
news:Oj***************@tornado.rdc-kc.rr.com...
Thanks Cor -- )

I am trying to trap state changes for a child table on a form when from
'unchanged' to 'modified' or 'added.' The code I am using does not do
this. I will repost it here:

form load:
========
cmT2 = CType(Me.BindingContext(Me.DataSet11.Tables!table2 ),
CurrencyManager)


There is a chance you're getting the wrong CurrencyManager and so the
wrong
Current DataRowView. You have to use the same DataSource/DataMember that
you used for binding to get the CurrencyManager.

Eg.:
detailGrid.DataSource = DataSet11
detailGrid.DataMember = "master_table.master_to_detail_relation"

cmT2 = DirectCast(BindingContext(DataSet11,
"master_table.master_to_detail_relation"), CurrencyManager)

A more generic way:
cmT2 = DirectCast(BindingContext(detailGrid.DataSource,
detailGrid.DataMember), CurrencyManager)

Also, if your detail table can contain multiple detail rows for each
master
row, then you might want to use detailTable.GetChanges() or
detailTable.Select(), because the user could have changed multiple detail
rows before navigating master rows.

HTH,
Greetings



custom SaveRecord event:
===================

cmT2.EndCurrentEdit()

Select Case cmT2.Current.row.rowstate
Case DataRowState.Added
Stop
Case DataRowState.Modified
Stop
End Select
Before the postion changes on the form's master record, the 'saverecord'
code is called. When I make changes to the datagrid - which is populated
by the 'child' table and linked via the 'datamember' property using the
'table1table2' relation - and then move to another 'parent' record the
saveRecord event is called does not report an 'Added' or 'Modified' state
in the child table.

any ideas?


"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...
Astro,

I am afraid that I don't understand your problem, however, a rowstate
reflects only the state of the changed datarow, where it is not
important
if this is a child or a master.

To get more answers, I give you the advice to past in next time your
code
first in a notebook copy it back and past it in a message. Now it is
hard
to see in most newsreaders what your code looks like.

I hope this helps anyhow

Cor



Nov 21 '05 #6
See Bart's response Cor.

0)

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Astro,
Before the postion changes on the form's master record, the 'saverecord'
code is called.


How are you able to do that? (before)

Cor

Nov 21 '05 #7

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

Similar topics

0
by: TEbert | last post by:
I have an Expression based DataColumn that is defined to calculate the Qty sum of all child rows, based on a self-referencing relationship (i.e. Parent.aggregateQty =...
6
by: BStorm | last post by:
Is it possible to change individual RowState properties from updated to not updated?
3
by: John Dalberg | last post by:
I am setting the HttpContext.Current.User in the Application_AuthenticateRequest event in global.asax.cs. When I use the IsInRole function in a web page, it works fine. So far so good. (Note that...
3
by: | last post by:
Hi all, I have a question on reflection Lets say I have a custom object called Address. Now, lets say I have a string variable that holds the name of a variable in the object such as...
2
by: osmarjunior | last post by:
Is there a way to change manually the RowState property of a DataRow, in a DataTable?? I wanna create a DataTable in memory, so I do the following: DataRow row = tbl.DataTable.NewRow(); row =...
3
by: namewitheldbyrequest | last post by:
"The XML element 'EnableTheming' from namespace 'http://tempuri.org/' is already present in the current scope" I created a Web Service: I imported System.Data.SqlClient so I could access SQL...
1
by: Arpan | last post by:
What's the difference between RowState & DataViewRowState? If I am not mistaken, RowState pertains to DataTable whereas DataViewRowState pertains to DataView but the "Select" method of the...
13
by: Dale Harris | last post by:
I'm getting really strange behaviour where the data source RowState is not being updated to modified in some circumstances. I place my controls on a form, bind them through a BindingSource control...
3
by: perspolis | last post by:
Hi all I have a master detail table which I use them in Transaction to Update them. in some cases the detail table generates error and I Rollback transaction but RowState of master table dosen't...
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
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
jinu1996
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...
0
tracyyun
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...
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...

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.