DataSet and events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a problem in the order that events are fired when adding new rows to a typed Dataset

The problem is i have a multi filed primary key, and some of the fields are not set by the user, ie, they are set in code

The problem is that the DataSet is validating the row and rejecting it before my code has a chance to set the values in the primary keys. Eg

1) The user goes to a new row in a DataGrid to add a new recor
2) They fill in some field
3) ColumnChanging and ColumnChanged events occur naturall
4) The user moves off the row and the framework code immediately fails because one of the primary keys is null
5) The RowChanging event never occurs

To me this is a bug - the RowChanging event should always fire first to give the user (ie my code) a chance to set values and do some internal validation. The dataset can then perform its validation before firing the RowChanged event

If by design, then its bad design

Regard
Michae
 
with ur statements i'm sure that column changing event is raised

in column changing event handler u check whether all the columns for the new row are set if set in ur code u raise the event of row validation

<< hope after entering all the values in the row he is pressing submit or addnewrow ( any command that generated an event to add new row) >

All the best
 
Back
Top