?
Solved

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

Posted on 2010-09-23
1
Medium Priority
?
455 Views
Last Modified: 2013-11-05
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
Comment
Question by:Lorna70
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
crisco96 earned 1000 total points
ID: 33745159
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question