Hi there,
Use Row directly. Also make sure you change the value only when it hass been
added:
protected void table_RowChanged(object sender, DataRowChangeEventArgs e)
{
if (e.Action == DataRowAction.Add)
e.Row[itemIndex] = newValue;
}
Hope it helps
--
Milosz
[quoted text, click to view] "Amir Tohidi" wrote:
> Sorry, the penultimate paragpraph should read:
>
> The line above executes without errors BUT my change is NOT BEING applied to
> the DataRow!
>
>
> "Amir Tohidi" wrote:
>
> > Hi
> >
> > I need to trap the insertion of a new row into a DataTable while it is being
> > filled by a data adaptor. I am trapping the RowChanged event and using the
> > following syntax to try and modify the row:
> >
> > e.Row.ItemArray(index) = newValue
> >
> > The line above executes without errors BUT my change is actually applied to
> > the DataRow!
> >
Thanks Martin & Milosz - your comments helped me solve the problem.
[quoted text, click to view] "Milosz Skalecki [MCAD]" wrote:
> Hi there,
>
> Use Row directly. Also make sure you change the value only when it hass been
> added:
>
> protected void table_RowChanged(object sender, DataRowChangeEventArgs e)
> {
> if (e.Action == DataRowAction.Add)
> e.Row[itemIndex] = newValue;
> }
>
> Hope it helps
> --
> Milosz
>
>
> "Amir Tohidi" wrote:
>
> > Sorry, the penultimate paragpraph should read:
> >
> > The line above executes without errors BUT my change is NOT BEING applied to
> > the DataRow!
> >
> >
> > "Amir Tohidi" wrote:
> >
> > > Hi
> > >
> > > I need to trap the insertion of a new row into a DataTable while it is being
> > > filled by a data adaptor. I am trapping the RowChanged event and using the
> > > following syntax to try and modify the row:
> > >
> > > e.Row.ItemArray(index) = newValue
> > >
> > > The line above executes without errors BUT my change is actually applied to
> > > the DataRow!
> > >
Hello Amir,
Actually the ItemArray is a copy of the cells' values of the TableRow
the proper code should be e.Ro(index) = newValue
In this case the update should run without problems
Regards
Martin
[quoted text, click to view] > Sorry, the penultimate paragpraph should read:
>
> The line above executes without errors BUT my change is NOT BEING
> applied to the DataRow!
>
> "Amir Tohidi" wrote:
>
>> Hi
>>
>> I need to trap the insertion of a new row into a DataTable while it
>> is being filled by a data adaptor. I am trapping the RowChanged event
>> and using the following syntax to try and modify the row:
>>
>> e.Row.ItemArray(index) = newValue
>>
>> The line above executes without errors BUT my change is actually
>> applied to the DataRow!
>>
>> What am I doing wrong please?
>>
Don't see what you're looking for? Try a search.