Solved

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

Posted on 2010-09-23
1
446 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 250 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

705 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