Just a simple problem, but without knowing the source of the problem, quite a troublesome for you and also time wasting effort (just like me :P).
Ok, let met tell you my problem first.
The first time it run, everything run just like what i'm expected. But the problem occured when i tried to run the second time, i don't know why, but it seems the popup window aspx just don't like to rebinding the controls, as if the Page_Load method is never hit. I know this because the controls in the popup window just act like the same and previous one, although i have altered the value in the database. It's weird.
After a while, looking and searching for the same problem in Google, i just recogn that the source of the problem was :
If the Page_Load event doesn't fire, then probably the page is loaded from the cache, and no roundtrip is made.
Finally, using a KISS (Keep It Simple and Stupid) method, i tried the simple thing, adding new parameter in the querystring of the popup with a value that will always change, something like date or time.
And this is the sample result of my solution :
"popNew.aspx?" + new Date().getTime() + "&ID=" +pID
With this, the popup will always be reload by the asp.net engine (because it doesn't cache the page) and surely it will always hit the Page_Load method in the Code behind, and my page will always reflect the newest value from database.
my final full code for popup :
var myObject = new Object();
var strUrl = "uc/GridSettings.aspx?" + new Date().getTime() + "&ID=" + modifyID;
var params = window.showModalDialog(strUrl, myObject, "dialogHeight: 100px; dialogWidth: 200px; scroll: No;");
if (params == "OK")
By. Tomy Ismail