Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Gridview does not refresh after update to DetailsView

Posted on 2006-07-08
6
Medium Priority
?
11,178 Views
Last Modified: 2012-06-21
I have a gridview which allows me to show the details through a DetailsView server control.

The DetailsView allows updates and inserts. Whenever I update or insert a record through the DetailsView my GridView does not show the changes.

Is there a way to force the SQLDataSource or GridView to refresh?
0
Comment
Question by:SuperGhosty
[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
6 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 17064739
Bind the data again to GridView after update or insert.
0
 
LVL 3

Author Comment

by:SuperGhosty
ID: 17066587
I tried clearing the datasource and datasourceid then rebinding to the SQLDataSource server control and it still does not show the changes.
0
 
LVL 3

Author Comment

by:SuperGhosty
ID: 17066648
I solved the problem,

for those who are having the same issue here is the diagnosis:

If you have a "Master - Details" set up with a gridview (master) and detailsview (details) and after inserting or updating in the detailsview the gridview does not update then you're calling the DataBind() in the wrong place. You should call the DataBind command on the DetailsView's "ItemUpdated" event. I believe the problem is the order of page events, if you call the databind after the update then it's too late and the gridview will not update.

    Protected Sub DetailsView1_ItemUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdatedEventArgs) Handles DetailsView1.ItemUpdated
        GridView1.DataBind()
    End Sub
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 17105784
Closed, 125 points refunded.
Netminder
Site Admin
0
 

Expert Comment

by:Nathan08
ID: 22754213
I was also having trouble with this, I fixed it by adding my unique field to the DataKeyName in the formview properites, it then updated the table.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
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…
Suggested Courses

604 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