Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   open webform with client script but cant close it (http://www.velocityreviews.com/forums/t593202-open-webform-with-client-script-but-cant-close-it.html)

ton 02-21-2008 12:18 PM

open webform with client script but cant close it
 
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,'stat us:no;dialogWidth:370px;dialogHeight:220px;dialogH ide: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





Eliyahu Goldin 02-21-2008 01:07 PM

Re: open webform with client script but cant close it
 
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" <ton@nospam.nl> wrote in message
news:b5943$47bd6bff$541eee8e$13678@cache3.tilbu1.n b.home.nl...
> 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,'stat us:no;dialogWidth:370px;dialogHeight:220px;dialogH ide: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
>
>
>
>




ton 02-21-2008 01:33 PM

Re: open webform with client script but cant close it
 
WOUW

it worked great thanks

Ton

"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN@mMvVpPsS.org> schreef in
bericht news:uZMQorIdIHA.2268@TK2MSFTNGP02.phx.gbl...
> 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" <ton@nospam.nl> wrote in message
> news:b5943$47bd6bff$541eee8e$13678@cache3.tilbu1.n b.home.nl...
>> 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,'stat us:no;dialogWidth:370px;dialogHeight:220px;dialogH ide: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
>>
>>
>>
>>

>
>



bruce barker 02-21-2008 04:36 PM

RE: open webform with client script but cant close it
 
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)


"ton" wrote:

> 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,'stat us:no;dialogWidth:370px;dialogHeight:220px;dialogH ide: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
>
>
>
>
>


siccolo 02-22-2008 12:52 AM

Re: open webform with client script but cant close it
 
On Feb 21, 11:36*am, bruce barker
<brucebar...@discussions.microsoft.com> wrote:
> 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)
>
>
>
> "ton" wrote:
> > 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,'stat us:no;dialogWidth:370px;d*ialogHeight:220px;dialog Hide: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- Hide quoted text -

>
> - Show quoted text -


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


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


All times are GMT. The time now is 09:32 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.