i have a Gridview which is bind with a table adapter to a database. On this form i have a button for deleting records and it works very well. When i'm deleting a record and i'm refill the table adapter i immediately see the changes.
But here's the problem. When i'm trying to insert a new user from a another form (not that one, where the gridview is), then the changes are not updated.
I've tried to Refresh the MasterTemplate from the other form, but that doenst work. Also i placed a sub on the form with the gridview and tried to call it from the other form, but that doenst works neither.
But when i place a button on the original form where the gridview is and i fire the sub with the button, the changes are working well!
Can anybody help me with this issue?
Greets
5 Answers, 1 is accepted

Hey Shaggy,
you didnt' tell how the insert action is implemented.
Generally speaking, you have to refresh the data that the grid is bound to and the grid will automatically update.
if the code behind your insert button modifies the same datasource the grid is bound to, the grid will be notified and update.
Calling refresh on the grid will not requery the database. That you will have to do on the datasource bound to the grid.
Regards
Erwin

thank's for your answer, but it doesnt helps me. I try to explain my problem a little more.
On a form a i have a GridView which is bound to a table in the database. The table is bound to a Table Adapter, which i fill on load (see Code).
I also have a button on that form, to delete a record from the database, and that works fine.
Public
Sub
User_Load()
'A public sub for loading the Table Adapter
Me
.UsersTableAdapter.Fill(
Me
.ConnectionString.Users)
End
Sub
Private
Sub
frmMain_Load(sender as
Object
, e as EventArgs)
Handles
MyBase
.Load
User_Load()
End
Sub
Private
Sub
Button1_Click(sender as
Object
, e as EventArgs)
Handles
RadButton1.Click
'Deleting a specific Row from the Database with a function in a class
Dim
sql
As
New
clSQL
sql.DeleteRow(RadGridView1.SelectedRows.Item(0).Cells(0).Value.ToString
'Reloading the table adtapter
User_Load()
End
Sub
So i needed also the opportunity to add a new line to the datagrid, so i added a new form, where you can fill the fields you need in the grid. When i now call the Sub User_Load from the new form, nothing happens.
When i'm placing a "refresh" button on the main form and i'm calling the same sub it also works fine.
I don't get this :-/
Thanks for help!
Thank you for writing back,
When you have RadGridView bound to data table, it is not necessary to add/delete rows from the database and then to synchronize the grid by refilling the table adapter. You may add/delete rows directly using the RadGridView. This will modify the data-set and the table adapter. Please find attached a sample project.
Still, as Erwin mentioned, if you modify the data and fill the table adapter with it, the grid will automatically refresh.
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>

Hello I am new to Telerik and running a trial of the latest version of the winforms UI. I am using radgridview but I can't get my back end data to update either, in my case an update. I am calling the update method of my tableadapter and passing in the dataset as the argument to the update method, but it doesn't work. When I step through the call to the update method, with f11 in Visual Studio it just steps over it as if I used step over - f10.
I downloaded the posted sample project, but it looks like it is referencing a different / older version of telerik UI. and I can't get it to work.
Also, I am confused about the differences between doing this with a regular native winforms grid and radgridview. I have test code that works with a regular grid. I am also confused as to whether the data source should be the bindingsource, or the tables in the dataset? The radgrid seems to work identically in either case, but in both cases the backend data won't update.
Here the update data code from my save button click:
this.tblDISTRIBUTIONACTIVITYBindingSource1.EndEdit();
MessageBox.Show("Click OK to begin accept changes");
this.tmcprod1024DataSet1.AcceptChanges();
MessageBox.Show("ACCEPT changes of data set is done");
this.tblDISTRIBUTIONACTIVITYTableAdapter1.Update(tmcprod1024DataSet1.tblDISTRIBUTIONACTIVITY);
Thank you for writing.
Please refer to the following help article how to changes in your database: http://docs.telerik.com/devtools/winforms/gridview/populating-with-data/updating-the-database-with-ado.net
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress