Home All Groups Group Topic Archive Search About

Problems Updating GridView when bound to datatable

Author
3 Apr 2006 7:20 PM
john
I am having problem updating when GridView is bound to datatable.
Can enter edit mode fine but when I extract new and old values they are
the same (ie. the old and new values are exactly the same!!!)

any help would be greatly appreciated.

here is my code:

Dim cell As DataControlFieldCell =
gridSubscribers.Rows(e.RowIndex).Cells(1)
gridSubscribers.Columns(0).ExtractValuesFromCell(e.NewValues, cell,
DataControlRowState.Edit, True)

cell = gridSubscribers.Rows(e.RowIndex).Cells(2)
gridSubscribers.Columns(1).ExtractValuesFromCell(e.NewValues, cell,
DataControlRowState.Edit, True)

cell = gridSubscribers.Rows(e.RowIndex).Cells(1)
gridSubscribers.Columns(0).ExtractValuesFromCell(e.OldValues, cell,
DataControlRowState.Edit, True)

cell = gridSubscribers.Rows(e.RowIndex).Cells(2)
gridSubscribers.Columns(1).ExtractValuesFromCell(e.OldValues, cell,
DataControlRowState.Edit, True)

Dim records(e.NewValues.Count - 1) As DictionaryEntry
Dim oldRecords(e.OldValues.Count - 1) As DictionaryEntry
e.NewValues.CopyTo(records, 0)
e.OldValues.CopyTo(oldRecords, 0)

Author
4 Apr 2006 10:07 AM
Pipo
Have you defined the datakeyname property?

Hope this helps you

<j***@mullersys.com> wrote in message
Show quoteHide quote
news:1144092020.892039.59180@u72g2000cwu.googlegroups.com...
>I am having problem updating when GridView is bound to datatable.
> Can enter edit mode fine but when I extract new and old values they are
> the same (ie. the old and new values are exactly the same!!!)
>
> any help would be greatly appreciated.
>
> here is my code:
>
> Dim cell As DataControlFieldCell =
> gridSubscribers.Rows(e.RowIndex).Cells(1)
> gridSubscribers.Columns(0).ExtractValuesFromCell(e.NewValues, cell,
> DataControlRowState.Edit, True)
>
> cell = gridSubscribers.Rows(e.RowIndex).Cells(2)
> gridSubscribers.Columns(1).ExtractValuesFromCell(e.NewValues, cell,
> DataControlRowState.Edit, True)
>
> cell = gridSubscribers.Rows(e.RowIndex).Cells(1)
> gridSubscribers.Columns(0).ExtractValuesFromCell(e.OldValues, cell,
> DataControlRowState.Edit, True)
>
> cell = gridSubscribers.Rows(e.RowIndex).Cells(2)
> gridSubscribers.Columns(1).ExtractValuesFromCell(e.OldValues, cell,
> DataControlRowState.Edit, True)
>
> Dim records(e.NewValues.Count - 1) As DictionaryEntry
> Dim oldRecords(e.OldValues.Count - 1) As DictionaryEntry
> e.NewValues.CopyTo(records, 0)
> e.OldValues.CopyTo(oldRecords, 0)
>
Author
4 Apr 2006 11:05 AM
JF
I figured it out.  The grid was rebinding before the row updating
event.  I just changed the code so it binds after the update.