I was working a couple of days ago with the Developer Express components for ASP.NET, the latest version (9.1.3), and I wanted to do a simple task, nothing fancy just having an ASPxGridView to show some rows of data from a SQL Server table, and when double clicking on the row show a popup window with a link to another page to edit that row.
Now, I was doing everything by the book, the app was working fine, but suddenly I started to see a side effect of the popup control. If I modified a row of data, close the popup, and immediately double click on the row again to re-edit, the new changes weren’t loaded.
I was shocked! How could this be possible? I was doing everything “by the book”, but it wasn’t working. So, tried several approaches, including the use of the client side function ASPxPopupControl.RefreshContentUrl() to try to force a refresh, de-selecting and re-selecting the row in the grid, and nothing was working. One thing I though I could do is to perform a callback with the function PerformCallback() in the client event Shown, but guess what, the control doesn’t have a Callback event as an add-on it doesn’t have a function to call the callback.
I did some research in the Developer Express Support website and found some information about how exactly the popup control worked. This is some information regarding the control:
- It doesn’t manage the “back” button history.
- The control uses the concept of Show/Hide instead of Open/Close.
- Can’t show/hide from server side code.
So, what I did in all the experimentation process was actually simple. When the popup was shown it loads the record information from the database, so, I have a button that perform the save operation which sends modified data again to the database, so I added an extra line in the save process (after it was successful) to reload the page using Response.Redirect. This way, the popup will be forced to reload the information as if it was the first time and the show/hide functionality would work as it was open/close.
The only thing that happen when using this approach is the visual effect of reloading but I guess there is no fix for that.
I’m still not sure if this approach is the best. It sure helped me achieve my goal but I think something in the RefreshContentUrl() function is not working the way it’s supposed to work.
Feel free to let me know any better approaches of dealing with this kind of situations or maybe this could help you get around the problems you’re having. Please comment as I would like to hear different ideas.