<$BlogRSDURL$>

Wednesday, February 23, 2005

Ok, now the background.
Using asp.net with c#, I had a bit of trouble getting a popupbox to display, allow input/deletion, and reflect this on the form that called the popup.
Looked around abit, found some really wierd solutions that to be honest, befuddled me somewhat and seemed overkill on what should of been a simple problem. The problem of firing an event on a different frame from a popupwindow.
So, my way of doing it;
create a HTML button, call it;
btnShowDetails
Set it to be a 'Run as Server Control', then jam in the code you want to run.
What this does, lets the button easily be called from the popup window using;

Response.Write("<script language='javascript'> {window.opener.__doPostBack('btnShowDetails', '') }</script>");

All this does is allow the button to receive the postback from the popup.
Not seen this anywhere, but seems a fair bit simpler than some other solutions I've found out there. To improve this, can have the callback javascript preregistered on the popupwindow to make it a tad easier to call (and to get round some popup blockers that might stop this calling across frames). This as is works for me, hope this is of use to someone else out there as it took a fair bit to sus this out.
Comments: Post a Comment

This page is powered by Blogger. Isn't yours?