This is a migrated thread and some comments may be shown as answers.

How to refresh girdview?

2 Answers 146 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anil
Top achievements
Rank 1
Anil asked on 23 Jan 2009, 12:47 PM
hi,

When i delete or update records,changes stored in to database but grid view didn't show updated records.

please send sample code gird view automatically refresh.

Thank You
Anil


2 Answers, 1 is accepted

Sort by
0
Marc Roussel
Top achievements
Rank 2
answered on 21 Jan 2010, 05:37 PM
I have the same issue where I add a new row and since the user do not enter the right data, I do CancelEdit() in RowEditEnded(..)
I see that my code removing the pending object from the collection is removed and it is automaticly removed from the grid but the VISUAL of the grid keeps the new row there.

Is there anyway to Refresh the grid ?

if I use rgvTimes.ItemsSource = MyCollection again, it crashed in this event,
rgvTimes.Rebind() make the application crashes too with : Object reference not set to an instence of an object

But which object please ?
when I get out of RowEditEnded, there's no place to go so where's the object not referenced ???
0
Marc Roussel
Top achievements
Rank 2
answered on 21 Jan 2010, 07:51 PM
Solved.

I was just not using the AddingNewDataItem and RowEditEnded the right way.
Tags
GridView
Asked by
Anil
Top achievements
Rank 1
Answers by
Marc Roussel
Top achievements
Rank 2
Share this question
or