Solved

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

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now