Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > helping with datagrid and binding navigation...
 

helping with datagrid and binding navigation...

Hello, im tryin to build some simple application using C#. im using the datagridview + the binding navigation. when im runing the app im available to delete and editing rows. after i click the save button its look like the app is saved the updates as long as the app still runing. After i close the app and return to the page i see the updates are not been saved (as well as they don't saved in the sql database). i know there should be some method that will handle this update (save) request by i can't find that over the net, someone can help?
  • Moved byHarry ZhuMSFTMonday, September 07, 2009 6:24 AMrelating to databinding (From:Visual C# General)
  •  
elidotnet  Saturday, September 05, 2009 12:53 PM
Hi elidotnet,

You said: After i close the app and return to the page. Could you please let me know if your application is of type WinForm?

In WinForm, when we want to update the data to database, we can follow the code snippet below:
private void BindingNavigatorSaveItem_Click(object sender, EventArgs e)
{    
    //Call EndEdit method of the binding source to save the input data to binding source.
    this.headerBindingSource.EndEdit();
    //Call the UpdateAll method of the TableAdapterManager to update data to database.
    //myDBDataSet1 is the DataSet. You can also call the Update method of the related DataAdapter.
    this.tableAdapterManager.UpdateAll(this.myDBDataSet1);
}
Sometimes we need to call the EndEdit method of the DataGridView at first.

Ifthe applicationis of type Asp.Net, you need to post from: http://forums.asp.net/.

Let me know if this does not help.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Tuesday, September 08, 2009 8:57 AM
Hi elidotnet,

You said: After i close the app and return to the page. Could you please let me know if your application is of type WinForm?

In WinForm, when we want to update the data to database, we can follow the code snippet below:
private void BindingNavigatorSaveItem_Click(object sender, EventArgs e)
{    
    //Call EndEdit method of the binding source to save the input data to binding source.
    this.headerBindingSource.EndEdit();
    //Call the UpdateAll method of the TableAdapterManager to update data to database.
    //myDBDataSet1 is the DataSet. You can also call the Update method of the related DataAdapter.
    this.tableAdapterManager.UpdateAll(this.myDBDataSet1);
}
Sometimes we need to call the EndEdit method of the DataGridView at first.

Ifthe applicationis of type Asp.Net, you need to post from: http://forums.asp.net/.

Let me know if this does not help.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Tuesday, September 08, 2009 8:57 AM

Hi elidotnet,

Could you please let me know if my reply helps or not?

Regards,
Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, September 09, 2009 6:14 AM

You can use google to search for other answers

Custom Search

More Threads

• Hidden fields
• Event
• Updating SQL Table from a dynamically populated DataGridView
• Trying to populate DataGridView with 2 tables from DataSet
• Cannot insert date in datagridview
• DataGridView.DataSource throwing Index was out of range exception
• How do I create a design-time databindable list?
• DataGridView StandardTab
• Appending Rows to Datagrid
• updating the datatable column