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

Rebind / refresh a changed dataset

5 Answers 203 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 06 Jun 2009, 11:12 AM
Hi All,

OK I am feeling somewhat stupid at the moment.  I have a Windows forms app with a datagrid on it.  In the menu I have an option to allow the user to resync the database with my main SQL database.  It uses merge replication and it all works fine.  The problem that I am having is stupidly simple by comparison to the task of syncing the data.  Once the syncronisation has finished, I need the datagrid to repopulate itself with any changed data.  2 minute job I thought, an hour later I still am having issues!

There are some threads discussing what I think is the same issue but people seem to be missing the stick and talking about setting the datasource to null and then reconnecting it.  Well that works but the RadGrid seems to then add in all of the hidden ID columns etc again.

Surely there is a command  like Refresh (what does that do anyway?  does it just redraw the grid?) that works on this.  On Asp.Net Refresh does as you'd expect and refreshes the data in the grid. 

All I want to do is tell the grid to reload it's data!

Any ideas anyone?

Regards,

Jon

5 Answers, 1 is accepted

Sort by
0
Jon
Top achievements
Rank 1
answered on 08 Jun 2009, 01:54 PM
Appears to have me being dumb.  I just needed to do use Fill on the dataadapter.

Should I have cleared the dataadapter first?  re memory leak issues...

Regards,

Jon
0
Martin Vasilev
Telerik team
answered on 10 Jun 2009, 01:14 PM
Hi Jon,

Thank you for writing. I thing that using the Fill method of the DataAdapter is the right way to refresh your data from database. You should not worry about memory leaks, because the Fill actually merges incoming rows with already existing ones. You can find more information on the topic in MSDN library.

Do not hesitate to contact me again if you have other questions.

Regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jon
Top achievements
Rank 1
answered on 11 Jun 2009, 11:20 AM
Hi Martin,

Great - good to have a second view on it!

I can't wait to get back on to web programming - win forms are more of a pain than I remembered them being ;)

Best Regards,

Jon
0
Lester
Top achievements
Rank 1
answered on 11 Feb 2011, 07:06 AM
If I understand correctly your post, you just want to refresh your grid after making changes to the dataset. I had the same problem and finally figure out how simple it was to do this.

Me.YOURTableAdapter.Fill(Me.YOURDataSet)

Hope it works for you !!

Lester
0
Jon
Top achievements
Rank 1
answered on 11 Feb 2011, 08:41 AM
Thanks Lester.  This was an old post and I got this sorted ages ago thankfully ;)

Cheers,

Jon
Tags
GridView
Asked by
Jon
Top achievements
Rank 1
Answers by
Jon
Top achievements
Rank 1
Martin Vasilev
Telerik team
Lester
Top achievements
Rank 1
Share this question
or