Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 471
  • Last Modified:

Insert using DetailsView doesn't update the GridView on same page.

Hi

I have a DetailsView for Inserting new records and a GridView for edting and deleting records - they are both using the same datasource (they are all contacts from the same company.  However, once a new record (contact) has been added via the DetailsView, the GridView is not rebound.  I have tried refreshing the page but the new record still doesn't show in the GridView.  If I come out of the page and go back in, they are all there.  What else do I have to do in my code to get them to show automatically after insert??  I am using .net 2.0 and I'm not using code behind (can do if necessary I'm sure).  Thanks Lorna
0
Lorna70
Asked:
Lorna70
1 Solution
 
crisco96Commented:
What you need to do is rebind the gridview.

I would suggest creating a code behind page for this.

Basically you need to wire up an event in the DetailsView for OnItemInserted. In your event handler (which will be in the code behind) just make a call to the DataBind() method in your gridview, so if your gridview's ID is GridView1 you'll do GridView1.DataBind()
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now