Hi,
I have a form(form1) and a gridview int it, and I am binding the grid with a datatable(access DB).
gridview.datasource = datatable
I have another form(form2) which pops-up from above form and I can add/delete rows to the above datatable(access DB).
I want to refresh the gridview on first form(form1) when form2 is closed.
How can I do this?
I have a form(form1) and a gridview int it, and I am binding the grid with a datatable(access DB).
gridview.datasource = datatable
I have another form(form2) which pops-up from above form and I can add/delete rows to the above datatable(access DB).
I want to refresh the gridview on first form(form1) when form2 is closed.
How can I do this?
5 Answers, 1 is accepted
0
AspenSquare
Top achievements
Rank 1
answered on 26 Jun 2012, 03:55 PM
private void btnClose_Click(object sender, EventArgs e)
{
ActiveForm.Close();
form1.UpdateGrid();
}
Something like the above?
0
TelDev
Top achievements
Rank 1
answered on 26 Jun 2012, 05:12 PM
Thanks Eric, but I am already doing like that. My only problem is that i do not want to create an instance of parent form and call a method of it. I am looking for something like notify an update in gridview or data source.
0
Hi Babu,
If the RadGridView is bound to the same instance of the DataTable object in Form1 and Form2 the data in RadGridView in Form1 must automatically be updated. Please verify DataTable instances used in Form1 and Form2. If you want to explicitly refresh the data in a grid control you can call the Refresh method of the GridViewTemplate. If you continue to experience issues, please send us a sample project so we can investigate it locally and find best solution for the case.
All the best,
Julian Benkov
the Telerik team
If the RadGridView is bound to the same instance of the DataTable object in Form1 and Form2 the data in RadGridView in Form1 must automatically be updated. Please verify DataTable instances used in Form1 and Form2. If you want to explicitly refresh the data in a grid control you can call the Refresh method of the GridViewTemplate. If you continue to experience issues, please send us a sample project so we can investigate it locally and find best solution for the case.
All the best,
Julian Benkov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
TelDev
Top achievements
Rank 1
answered on 29 Jun 2012, 08:07 AM
Thanks Julian for the reply.
I think you mis understood my first post. I am not using the same datatable in both forms.
Gridview in form1 is populated directly from access database(using ADO objects).
In form2 addition of new rows is directly inserted into access databse. There is no link to datatable of form1.
form1.gridview.datasource = getdatafromaccessdatabasetable(tbl1)
In form2 Insert into accessdatabasetable(tbl1)
How to explicitly refresh the data of grid whn closing the form2. Is there a way to do it instead of doing form1.grid.refresh.
Thanks
TelDev
I think you mis understood my first post. I am not using the same datatable in both forms.
Gridview in form1 is populated directly from access database(using ADO objects).
In form2 addition of new rows is directly inserted into access databse. There is no link to datatable of form1.
form1.gridview.datasource = getdatafromaccessdatabasetable(tbl1)
In form2 Insert into accessdatabasetable(tbl1)
How to explicitly refresh the data of grid whn closing the form2. Is there a way to do it instead of doing form1.grid.refresh.
Thanks
TelDev
0
Hi Babu,
In this scenario you can call the Fill method of your OleDBAdapter in Form1 if you use ADO DBAdapter for loading the data or reload tbl1 table manually. If RadGridView is bound to a BindingSource or DataTable, after the reload operation the grid control will automatically update itself.
I hope this helps. Let me know if you need further assistance.
Greetings,
Julian Benkov
the Telerik team
In this scenario you can call the Fill method of your OleDBAdapter in Form1 if you use ADO DBAdapter for loading the data or reload tbl1 table manually. If RadGridView is bound to a BindingSource or DataTable, after the reload operation the grid control will automatically update itself.
I hope this helps. Let me know if you need further assistance.
Greetings,
Julian Benkov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>