Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp:content - configuring onload event

Status
Not open for further replies.

DarwinIT

Programmer
Apr 25, 2008
142
0
0
US
I have a requirement to launch a secondary page as a pop-under when a certain page opens. That page uses a master page and asp:Content object - so there is no body tag to tweak in the aspx markup.
The way I understand I need to do a pop-under is to launch a new window object via javascript and call the blur method on that window object. I'm not sure how to fire up that javascript without a that is generic to the master page. I tried setting the attribute to that but that is not working. The ID of the body tag is dynamic with the value set by a property called BodyID

HtmlGenericControl _body = (HtmlGenericControl)Master.FindControl(Master.BodyId);

comes up with null for the _body object. I'm thinking the assignment hasn't occurred yet in the Page_Load method??

Anyway - perhaps there is a better way to accomplish what I'm trying to do. Any help would be greatly appreciated.




 
The business requirement is to show a thank you page after a client places an order and then popping under a second window which they will find later which suggests other things they might be interested in (marketing games (and bs).
I think I just figured it out. I'll put some <% variable/property %> in the master page and will only populate that value with onload=xxx on the pages where I want to use this popup. In theory that should work.

 
That did the trick. I could not just put in a <% something %> without a valid property - so I put in Onload="<% variable %>"

and then I set the variable to innocuous javascript so nothing is done - unless the pages I want to invoke the pop under window are invoked. Then I set the variable to contain the open window javascript

TheNewWin =window.open('" + "pagename.aspx','TheNewpop','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');TheNewWin.blur();

Thanks for the feedback.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top