Hey Man!
The Problem you've gotten into is quite a huge one. I'm making a project and I've fallen into something like that. The issue here is that whenever you call an event(clicking a button for example), the Page_Load event is called, making the page to reload, then the code within the event you just called is executed; so, if you'd want to modify anything on the parent form, you'd have to refresh or reload the page. Another issue I've found has something to do with the "Modal Openers" methods(i.e. Response.Write, RegisterClientScriptBlock or RegisterStartupScript). These methods just make a reference to another page, a Modal Dialog in this case, but they don't work as constructors. For example, when I call a constructor, the code below that call "waits" till the object from the other class is created. The problem radicates here: if there's any piece of code below those "Modal Openers" it'll execute anyway, so if you wanted to do anything with the returned value, that's not possible.
In my case, in the Modal Form I ask the user to select some data, then I store that data into a DataBase and the Modal Form closes. Well, the thing is that I placed the code to acces that data just after the Response.Write method, the result: throws an exception because the data hasn't been stored. Quite frustrating. I hope someone kwons some way to solve this problem, it's now going on a world scale.....
Curiosity S-killed the Cat
|