PC Review


Reply
Thread Tools Rate Thread

Business logic per typed datatable

 
 
Blast
Guest
Posts: n/a
 
      12th Oct 2007
I want to validate my data at the typed dataset level and not at the
datagridview / ui level. Data validation is a business rule and as
such should be a different layer then the UI.

Basically, I have a class made for each datatable in my typed dataset.
The class has the abilitiy to fill a specific datatable, do searches
and join etc. I want to place my business logic in this class.
However, the only event I see for a type datatable is the rowchanged
event. I can't figure out how to get the change information per cell.
For example, if someone is changing a cell value from x to b, I want
to validate that change. So I need the proposed value and the existing
value of the cell before I allow it to be changed in the typed
datatable. Is this possible to do, have I overlooked an event for the
typed datatable?

-Watson

 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      12th Oct 2007
Watson,

AFAIK did you overlook nothing, when you want this you can check per Row as
the event for that is triggering, AFAIK is the cell change in a DataTable
not triggering.

Cor

 
Reply With Quote
 
Blast
Guest
Posts: n/a
 
      12th Oct 2007
On Oct 11, 9:31 pm, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
> Watson,
>
> AFAIK did you overlook nothing, when you want this you can check per Row as
> the event for that is triggering, AFAIK is the cell change in a DataTable
> not triggering.
>
> Cor


I guess i'm not sure how to figure out what the proposed value is and
what the new value is for each cell of the row. For example, when a
when I hook into a row changing event, how do I iterate through each
cell in that row and get the proposed value and original value?

 
Reply With Quote
 
Blast
Guest
Posts: n/a
 
      12th Oct 2007
You can hook into the DataRowChangeEventHandler of a datatable and get
notification when a row changes. However, I want to know which cell in
the row changed and what the proposed and original values are for that
cell - not the entire row itself. I can't see how to do this....

 
Reply With Quote
 
Blast
Guest
Posts: n/a
 
      12th Oct 2007
Ah, I think this works to find out if the current and proposed values
are different for a cell in the row changing event:

e.Row["Col Name", DataRowVersion.Original] == e.Row["Col Name",
DataRowVersion.Proposed];

 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ErrorProviders and How can I encapsulate business logic in typed datasets??? windsurfing_stew@yahoo.com.au Microsoft Dot NET Framework Forms 3 28th Jun 2006 08:05 AM
How do I assign a typed DataTable to its typed DataSet? A.M-SG Microsoft ADO .NET 6 1st Feb 2006 06:13 AM
Convert a DataTable to a Strongly Typed DataTable. Anibal Microsoft ADO .NET 4 22nd Jan 2005 05:26 PM
How can I add a row from a typed datatable to another instance of that typed datatable? Ersin Gençtürk Microsoft ASP .NET 1 6th Oct 2004 02:11 PM
Converting an untyped datatable into a typed datatable =?Utf-8?B?UmFrZXNoIFJhamFu?= Microsoft C# .NET 0 17th Jun 2004 01:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:27 PM.