views:

111

answers:

2

I have a button click event on a page which ultimate updates a table using:

protected void Button2_Click(object sender, EventArgs e)
        {
         this.AccessDataSource6.Insert();
        }

A GridView bound to a different AccessDataSource, displays data that is updated by the Insert.

What do I need to include in Button2_Click for the GridView to be refreshed?

+1  A: 

The GridView.DataBind Method will clear and re-populate your grid view (assuming the datasource is already set - see the link for an example).

JohnIdol
+1  A: 

On your click event after you insert you should called the GridView.DataBind() method to rebind the data...

protected void Button2_Click(object sender, EventArgs e)
{
    this.AccessDataSource6.Insert();
    this.gridView1.DataBind();
}
Chalkey