Solved

Refreshing a DataBound grid

Posted on 2011-02-14
5
2,889 Views
Last Modified: 2012-05-11
Hi,

I have an Infragistics WebDataGrid which is data bound to an asp:ObjectDataSource.  This seems to work OK.  Each row in the grid has an edit and delete button.

When the edit button is clicked I popup a WebDialogWindow to edit the data displayed on the row.  Clicking OK calls some client side javascript to validate the data and if ok calls a server side btnON_OnClick function.

In this function, I save the updated data back to the database and call
   
    GridUsers.DataBind()

My thought was that this would cause the data source to refresh and update the grid with the changes just made.  Stepping through in debug, I can see that the DataBind() does indeed cause the underlying data source to re-read the objects from the database and this does pick up the changes - however the GRID does not seem to show these changes uintil I refresh the page????

I am certain that the DataBind is causing the ObjectDataSource to refresh - why isn't the grid refreshing also?  Do I have to call anything else to cause the display to refresh?
0
Comment
Question by:ChrisMDrew
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:xav056
ID: 34889250
put your webgrid in an Ajax update panel
that should do it for you, the page needs to refresh the view, you can do this with an async post back if you add an update panel
0
 

Author Comment

by:ChrisMDrew
ID: 34889528
The WebDataGrid is supposedly a full Ajax control - never the less I added an UpdatePanela round it but unfortunately no effect...
0
 
LVL 9

Expert Comment

by:xav056
ID: 34889990
make sure the update mode is set to always in the update panel
0
 

Accepted Solution

by:
ChrisMDrew earned 0 total points
ID: 34914606
Seems as though there might be a slight bug in the WebDataGrid - you have to clear the existing object collection using :-

grid.Rows.Clear();
grid.DataBind();

This then refreshes correctly but even the UpdatePanel did not fix the problem.  This has also been raised in the Infragistics forums so I am pretty happy that this is the 'fix'.
0
 

Author Closing Comment

by:ChrisMDrew
ID: 34949639
Unfortunately the update panel does not work - seems to be a bug in the implementation of the control
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delete HTML table rows 12 35
Deploying to Azure 3 39
Easy filter aspnet 2 27
Is it possible to preview ajax call before submitting to the database? 18 43
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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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