close subwindow using vb.net

  • Thread starter Thread starter Marcel
  • Start date Start date
M

Marcel

I have a subwindow hich displays a grid. When the user selects a row from
the grid, I wish to store the selected row ID in session state and close the
subwindow, returning focus to the parent (opener).

Normally I would do this in javascript, but I cannot find any client side
intelligence in the grid, so I wish to close the window on the select index
changed event when I return to the server.

I can't remeber how to add an OnLoad attribute to the <BODY> tag - as that
would do it.

Please help.
Marcel
 
For do this normally I use the RegisterClientScriptBlock() method of Page.

Example :
string s = "<script>window.close();</script>";
RegisterClientScriptBlock("close", s);

If you want to put code in onload you can make body runat=server and then
declare this in your page as generic HtmlControl so you can write :
html.Attributes["OnLoad"] = ".....";

you can write all your javascript here, or call a function and then put it
on client with RegisterStartupScript method (the use is similar to
RegisterClientScriptBlock)!

Brun.
 
Back
Top