open webform with client script but cant close it

  • Thread starter Thread starter ton
  • Start date Start date
T

ton

Hi,

I 've a problem. Consider 2 webforms
webform1 got a button: in the Page_Load event, this code:

Button1.Attributes.Add("onclick",
"window.showModalDialog('webform2.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');")

the 2nd form got a button2 in the Page_Load event, this code:

Button2.Attributes.Add("onclick", "window.close();")

what happens is that the second dialog is a nice pop-up, but after closing
it is closed and RELOADED again (but then not as modal form and not in the
specified height/width

What am I doing wrong??


Ton
 
WOUW

it worked great thanks

Ton

Eliyahu Goldin said:
Add this line to the <head> section of the page you open as a modal
dialog:

<base target="_self"/>

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


ton said:
Hi,

I 've a problem. Consider 2 webforms
webform1 got a button: in the Page_Load event, this code:

Button1.Attributes.Add("onclick",
"window.showModalDialog('webform2.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');")

the 2nd form got a button2 in the Page_Load event, this code:

Button2.Attributes.Add("onclick", "window.close();")

what happens is that the second dialog is a nice pop-up, but after
closing
it is closed and RELOADED again (but then not as modal form and not in
the
specified height/width

What am I doing wrong??


Ton
 
as noted, the webform events are only fired by an async postback. control
extenders just subscribe to generic browser events (onclick, onfocus, etc),
so there is no generic tell me when you are done.

but some extenders will fire events your javascript can subscribe to. the
auto complete has several events (just look at the javascript code, the best
documentation). for autocomplete, maybe populated (fired after list is
loaded) is the event you want, not sure what you are trying to do.

-- bruce (sqlwork.com)
 
as noted, the webform events are only fired by an async postback. control
extenders just subscribe to generic browser events (onclick, onfocus, etc),
so there is no generic tell me when you are done.

but some extenders will fire  events your javascript can subscribe to. the
auto complete has several events (just look at the javascript code, the best
documentation).  for autocomplete, maybe populated (fired after list is
loaded) is the event you want, not sure what you are trying to do.

-- bruce (sqlwork.com)










- Show quoted text -

sometimes, it also helps to show second web form in a iframe....


... more at http://www.siccolo.com/articles.asp...
 
Back
Top