Reputation: 989
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?
Upvotes: 6
Views: 31696
Reputation:
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();
}
Upvotes: 5
Reputation: 50097
The GridView.DataBind Method will clear and re-populate your grid view (assuming the datasource is already set - see the link for an example).
Upvotes: 6