I would like to generate non-modal popup windows from
ASP.Net code-behind. I have tried using Client Side
scripting like "function Test(){
window.open('test.htm',_blank,
'height=200,width=400,status=no,toolbar=no,
menubar=no,location=no resizable=no
scrollable=no');
but I can't seem to invoke the client side script from
within a Server Side Form. I know I can use the context
with to Response.redirect or Server.transfer to return a
different page, but can't figure how generate a pop-up
window for an 'About' page or a "Contacts" page. 12 12200
"HarveyB" <ha*****@compass-soft.com> wrote in message
news:01****************************@phx.gbl... I would like to generate non-modal popup windows from ASP.Net code-behind.
How about using Response.Write in your server side code:
Response.Write("<script language='javascript'>window.open(....)</script>");
---
Steven Wood -----Original Message-----
"HarveyB" <ha*****@compass-soft.com> wrote in message news:01****************************@phx.gbl... I would like to generate non-modal popup windows from ASP.Net code-behind. How about using Response.Write in your server side code:
Response.Write("<script language='javascript'>window.open
(....)</script>"); --- Steven Wood
I don't think that solves the problem. It will place a
script on the returned page, but how is the script invoked
from the Server Side. The issue here is to open a pop-up
window from the server side. 'Window' is a client-side
object.
Harvey Bernstein
Hi HarveyB,
I do not believe that there is a method to open a client window without
using the client script.
For security concern, it is non-security to open a window from server-side.
Did I answer your question?
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- Content-Class: urn:content-classes:message From: "HarveyB" <ha*****@compass-soft.com> Sender: "HarveyB" <ha*****@compass-soft.com> References: <01****************************@phx.gbl>
<uK*************@TK2MSFTNGP12.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Wed, 10 Sep 2003 17:50:25 -0700 Lines: 23 Message-ID: <02****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Thread-Index: AcN3/rAw3yfjfbmGRFOdbtTXl0V14A== X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:108058 NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 X-Tomcat-NG: microsoft.public.dotnet.general
-----Original Message-----
"HarveyB" <ha*****@compass-soft.com> wrote in message news:01****************************@phx.gbl... I would like to generate non-modal popup windows from ASP.Net code-behind.
How about using Response.Write in your server side code:
Response.Write("<script language='javascript'>window.open (....)</script>"); --- Steven Wood
I don't think that solves the problem. It will place a script on the returned page, but how is the script invoked from the Server Side. The issue here is to open a pop-up window from the server side. 'Window' is a client-side object.
Harvey Bernstein
You cannot invoke windows from the server without using some form of
remoting listener loaded at the client. HTTP is get/response protocol and
doesn't work like that.
The best you can do is pass out the information to invoke the window client
side with client side script, either from a buttonclick/hyperlink or via a
script event such as onload for body. There is some code for one of these
below.
--
Regards
John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------
<html>
<head>
<script language="VB" runat="server">
Sub Page_Load( sender as Object,e as EventArgs)
'Form the script that is to be registered at client side.
Dim scriptString as String = "<script language=JavaScript> function
DoClick() {"
ScriptString +=
"window.open('http://www.mvps.org','MyWindow','width=500,height=500');} <"
scriptString += "/"
scriptString += "script>"
If(Not IsClientScriptBlockRegistered("clientScript"))
RegisterClientScriptBlock("clientScript", scriptString)
End If
End Sub
</script>
</head>
<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">
<INPUT id="launchButton" onclick="DoClick();" type="button"
value="Submit" name="myButton" runat="server">
</form>
</body>
</html>
"HarveyB" <ha*****@compass-soft.com> wrote in message
news:01****************************@phx.gbl... I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server Side Form. I know I can use the context with to Response.redirect or Server.transfer to return a different page, but can't figure how generate a pop-up window for an 'About' page or a "Contacts" page.
The sample worked, but unfortunately I think I will need
to re-architect to do what I want. I have 3 problems.
1. The buttons are implemented inside an ASP:Datalist Cntl.
2. The plan was to encapsulate my menus in a user cntl
(ascx).
3. I am using code-behind.
Should I just go back to the drawing board. Each of the
conditions above seems to make implementing the sample
extremely difficult, if not impossible.
That is somewhat of a disappointment give that all 3 are
touted as advantages of ASP.NET. -----Original Message----- You cannot invoke windows from the server without using
some form ofremoting listener loaded at the client. HTTP is
get/response protocol anddoesn't work like that.
The best you can do is pass out the information to invoke
the window clientside with client side script, either from a
buttonclick/hyperlink or via ascript event such as onload for body. There is some code
for one of thesebelow. -- Regards
John Timney (Microsoft ASP.NET MVP) ---------------------------------------------- <shameless_author_plug> Professional .NET for Java Developers with C# ISBN:1-861007-91-4 Professional Windows Forms ISBN: 1861005547 Professional JSP 2nd Edition ISBN: 1861004958 Professional JSP ISBN: 1861003625 Beginning JSP Web Development ISBN: 1861002092 </shameless_author_plug> ----------------------------------------------
<html> <head> <script language="VB" runat="server">
Sub Page_Load( sender as Object,e as EventArgs)
'Form the script that is to be registered at client
side. Dim scriptString as String = "<script
language=JavaScript> functionDoClick() {" ScriptString += "window.open
('http://www.mvps.org','MyWindow','width=500,height=500');}
<" scriptString += "/" scriptString += "script>"
If(Not IsClientScriptBlockRegistered
("clientScript")) RegisterClientScriptBlock("clientScript",
scriptString) End If End Sub </script> </head> <body topmargin="20" leftmargin="10"> <form id="myForm" runat="server">
<INPUT id="launchButton" onclick="DoClick();"
type="button"value="Submit" name="myButton" runat="server">
</form> </body> </html>
"HarveyB" <ha*****@compass-soft.com> wrote in message news:01****************************@phx.gbl... I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server Side Form. I know I can use the context with to Response.redirect or Server.transfer to return a different page, but can't figure how generate a pop-up window for an 'About' page or a "Contacts" page.
.
Hi HarveyB,
It seems that you want to handle the button click event in the Datalist
control.
Here is a link about it. You may have check. http://groups.google.com/groups?q=da...hl=zh-CN&lr=&i
e=UTF-8&oe=UTF-8&selm=IzLFyfNJDHA.2344%40cpmsftngxa06.phx.gbl&rnu m=1
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- Content-Class: urn:content-classes:message From: "HarveyB" <ha*****@compass-soft.com> Sender: "HarveyB" <ha*****@compass-soft.com> References: <01****************************@phx.gbl>
<e9**************@TK2MSFTNGP12.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Thu, 11 Sep 2003 15:46:09 -0700 Lines: 115 Message-ID: <07****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Thread-Index: AcN4tn5CHJm1sJ8NQaC/pNsjWjEACw== X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:108210 NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161 X-Tomcat-NG: microsoft.public.dotnet.general
The sample worked, but unfortunately I think I will need to re-architect to do what I want. I have 3 problems.
1. The buttons are implemented inside an ASP:Datalist Cntl. 2. The plan was to encapsulate my menus in a user cntl (ascx). 3. I am using code-behind.
Should I just go back to the drawing board. Each of the conditions above seems to make implementing the sample extremely difficult, if not impossible.
That is somewhat of a disappointment give that all 3 are touted as advantages of ASP.NET.
-----Original Message----- You cannot invoke windows from the server without using some form ofremoting listener loaded at the client. HTTP is get/response protocol anddoesn't work like that.
The best you can do is pass out the information to invoke the window clientside with client side script, either from a buttonclick/hyperlink or via ascript event such as onload for body. There is some code for one of thesebelow. -- Regards
John Timney (Microsoft ASP.NET MVP) ---------------------------------------------- <shameless_author_plug> Professional .NET for Java Developers with C# ISBN:1-861007-91-4 Professional Windows Forms ISBN: 1861005547 Professional JSP 2nd Edition ISBN: 1861004958 Professional JSP ISBN: 1861003625 Beginning JSP Web Development ISBN: 1861002092 </shameless_author_plug> ----------------------------------------------
<html> <head> <script language="VB" runat="server">
Sub Page_Load( sender as Object,e as EventArgs)
'Form the script that is to be registered at client side. Dim scriptString as String = "<script language=JavaScript> functionDoClick() {" ScriptString += "window.open ('http://www.mvps.org','MyWindow','width=500,height=500');} <" scriptString += "/" scriptString += "script>"
If(Not IsClientScriptBlockRegistered ("clientScript")) RegisterClientScriptBlock("clientScript", scriptString) End If End Sub </script> </head> <body topmargin="20" leftmargin="10"> <form id="myForm" runat="server">
<INPUT id="launchButton" onclick="DoClick();" type="button"value="Submit" name="myButton" runat="server">
</form> </body> </html>
"HarveyB" <ha*****@compass-soft.com> wrote in message news:01****************************@phx.gbl... I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server Side Form. I know I can use the context with to Response.redirect or Server.transfer to return a different page, but can't figure how generate a pop-up window for an 'About' page or a "Contacts" page.
.
Ok, then is there a way to pass a message (of some type)
to the client side so that a client side javascript can be
fired to open the window.
I mean 'message' in the most generic meaning of the term.
I just want some way to detect the button click inside the
Datalist, handle the event on the server-side and then
hand it off to the client side. The reason for this is so
that the menu inside the datalist control can be dynamic
and based on either an XML file or a SQL Query.
It seems that this should be easy, but I have tried quite
a few ideas without success. -----Original Message----- Hi HarveyB,
I do not believe that there is a method to open a client
window withoutusing the client script. For security concern, it is non-security to open a window
from server-side.Did I answer your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. --------------------Content-Class: urn:content-classes:message From: "HarveyB" <ha*****@compass-soft.com> Sender: "HarveyB" <ha*****@compass-soft.com> References: <01****************************@phx.gbl> <uK*************@TK2MSFTNGP12.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Wed, 10 Sep 2003 17:50:25 -0700 Lines: 23 Message-ID: <02****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Thread-Index: AcN3/rAw3yfjfbmGRFOdbtTXl0V14A== X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.general:108058NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 X-Tomcat-NG: microsoft.public.dotnet.general
-----Original Message-----
"HarveyB" <ha*****@compass-soft.com> wrote in message news:01****************************@phx.gbl.. . I would like to generate non-modal popup windows from ASP.Net code-behind.
How about using Response.Write in your server side code:
Response.Write("<script
language='javascript'>window.open(....)</script>"); --- Steven Wood
I don't think that solves the problem. It will place a script on the returned page, but how is the script
invokedfrom the Server Side. The issue here is to open a pop-
upwindow from the server side. 'Window' is a client-side object.
Harvey Bernstein
.
Hi Harveyb,
Since the Browser/Server modal is based on request. That is to say, the
server will response to client browser with the html code at last when the
client make a request.
The server can not actively generate the html file (i.e. javascript )
without the browser request.
Have you check the suggestion of Steven, it is one method to invoke the
javascript in code behind?
Have you also check my last post that can handle the click event in the
datalist in my last post?
Did I answer your question?
If you have any related question,please feel free to let me know.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- Content-Class: urn:content-classes:message From: "Harveyb" <ha*****@panix.com> Sender: "Harveyb" <ha*****@panix.com> References: <01****************************@phx.gbl>
<uK*************@TK2MSFTNGP12.phx.gbl>
<02****************************@phx.gbl>
<jo**************@cpmsftngxa06.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Mon, 15 Sep 2003 14:20:54 -0700 Lines: 85 Message-ID: <05****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcN7zz9LPdhNaOMyRCub/9yArgi1YA== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa07.phx.gbl Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:108301 NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
Ok, then is there a way to pass a message (of some type) to the client side so that a client side javascript can be fired to open the window.
I mean 'message' in the most generic meaning of the term. I just want some way to detect the button click inside the Datalist, handle the event on the server-side and then hand it off to the client side. The reason for this is so that the menu inside the datalist control can be dynamic and based on either an XML file or a SQL Query.
It seems that this should be easy, but I have tried quite a few ideas without success.
-----Original Message----- Hi HarveyB,
I do not believe that there is a method to open a client window withoutusing the client script. For security concern, it is non-security to open a window from server-side.Did I answer your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. --------------------Content-Class: urn:content-classes:message From: "HarveyB" <ha*****@compass-soft.com> Sender: "HarveyB" <ha*****@compass-soft.com> References: <01****************************@phx.gbl> <uK*************@TK2MSFTNGP12.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Wed, 10 Sep 2003 17:50:25 -0700 Lines: 23 Message-ID: <02****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Thread-Index: AcN3/rAw3yfjfbmGRFOdbtTXl0V14A== X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gblmicrosoft.public.dotnet.general:108058NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 X-Tomcat-NG: microsoft.public.dotnet.general
-----Original Message-----
"HarveyB" <ha*****@compass-soft.com> wrote in message news:01****************************@phx.gbl. .. > I would like to generate non-modal popup windows from > ASP.Net code-behind.
How about using Response.Write in your server side code:
Response.Write("<scriptlanguage='javascript'>window.open(....)</script>");
--- Steven Wood
I don't think that solves the problem. It will place a script on the returned page, but how is the scriptinvokedfrom the Server Side. The issue here is to open a pop-upwindow from the server side. 'Window' is a client-side object.
Harvey Bernstein
.
The replies by both you and Steven are good as far as they
go. They explain that it is possible on the server side
to create and then register a client script.
That means that a user could click a button that would
postback a request for information. If you wish to return
the info in a pop-up, non-modal window, you could generate
a script to initiate the popup.
Of course you are still left with the problem of how that
script gets invoked. Having the user press ANOTHER button
is clearly not acceptable. Using an event such
as 'onload' is only useful if there is some way for the
script to determine what/when it is to take action.
The 'onload' event would fire everytime the page was
invoked, but the window.open would be discretionary.
There needs to be some mechanism to pass a message between
server and client in order for the script to know what to
do.
The obvious possibility would be in a hidden input
control. But the client side script seems to have trouble
reading the hidden control, especially if the control is
encapsulated in a User Control. It seems the User Control
compile process pre-pends the id of the User Control to
the control id, but the script can't use that name. So
there doesn't seem to be any way for the script to read
the value of the hidden control.
This make the proposed solution either extremely difficult
or perhaps impossible. Perhaps the correct approach is to
write a Server Control. That seems like an unnecessarily
complex approach, but may be the correct way to approach
this. Perhaps User Controls are best thought of as Server-
side includes.
HarveyB -----Original Message----- Hi Harveyb,
Since the Browser/Server modal is based on request. That
is to say, theserver will response to client browser with the html code
at last when theclient make a request. The server can not actively generate the html file (i.e.
javascript )without the browser request. Have you check the suggestion of Steven, it is one method
to invoke thejavascript in code behind? Have you also check my last post that can handle the
click event in thedatalist in my last post?
Did I answer your question? If you have any related question,please feel free to let
me know. Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. --------------------Content-Class: urn:content-classes:message From: "Harveyb" <ha*****@panix.com> Sender: "Harveyb" <ha*****@panix.com> References: <01****************************@phx.gbl> <uK*************@TK2MSFTNGP12.phx.gbl> <02****************************@phx.gbl> <jo**************@cpmsftngxa06.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Mon, 15 Sep 2003 14:20:54 -0700 Lines: 85 Message-ID: <05****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcN7zz9LPdhNaOMyRCub/9yArgi1YA== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa07.phx.gbl Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.general:108301NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
Ok, then is there a way to pass a message (of some type) to the client side so that a client side javascript can
befired to open the window.
I mean 'message' in the most generic meaning of the
term.I just want some way to detect the button click inside
theDatalist, handle the event on the server-side and then hand it off to the client side. The reason for this is
sothat the menu inside the datalist control can be dynamic and based on either an XML file or a SQL Query.
It seems that this should be easy, but I have tried
quitea few ideas without success.
-----Original Message----- Hi HarveyB,
I do not believe that there is a method to open a
clientwindow withoutusing the client script. For security concern, it is non-security to open a
windowfrom server-side.Did I answer your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights. -------------------- Content-Class: urn:content-classes:message From: "HarveyB" <ha*****@compass-soft.com> Sender: "HarveyB" <ha*****@compass-soft.com> References: <01****************************@phx.gbl> <uK*************@TK2MSFTNGP12.phx.gbl> Subject: Re: Popup Window generated from Server Side Date: Wed, 10 Sep 2003 17:50:25 -0700 Lines: 23 Message-ID: <02****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Thread-Index: AcN3/rAw3yfjfbmGRFOdbtTXl0V14A== X-MimeOLE: Produced By Microsoft MimeOLE
V5.50.4910.0300Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa06.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:108058NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 X-Tomcat-NG: microsoft.public.dotnet.general
>-----Original Message----- > >"HarveyB" <ha*****@compass-soft.com> wrote in message >news:01****************************@phx.gbl.. . >> I would like to generate non-modal popup windows
from>> ASP.Net code-behind. > >How about using Response.Write in your server side
code:> >Response.Write("<script language='javascript'>window.open(....)</script>"); > >--- >Steven Wood > I don't think that solves the problem. It will place
ascript on the returned page, but how is the script invokedfrom the Server Side. The issue here is to open a pop- upwindow from the server side. 'Window' is a client-
sideobject.
Harvey Bernstein
.
.
Hi Harveyb,
For the design of Browser/Server modal, I think you may use a javascript
function to restrieve the message from server repeatedly.
e.g.
You have two pages.
page1: the main page you show the datalist to the client.
page2: the page used to response the message to client just as you "push"
the message to the client.
a javascript function run repeatedly to retrieve the data from page2.
function querystatus()
{
GetXMLHTTP();//a customer function to retrieve the msg the server want
to response to the client.
setTimeout(querystatus,300);
}
For detailed information, please refer to the link below. http://groups.google.com/groups?q=%2...ct&hl=zh-CN&lr
=&ie=UTF-8&oe=UTF-8&selm=%249sGgp0YDHA.2172%40cpmsftngxa06.phx.gbl&r num=1
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
-------------------- Content-Class: urn:content-classes:message From: "HarveyB" <ha*****@panix.com> Sender: "HarveyB" <ha*****@panix.com> References: <01****************************@phx.gbl>
<uK*************@TK2MSFTNGP12.phx.gbl>
<02****************************@phx.gbl>
<jo**************@cpmsftngxa06.phx.gbl>
<05****************************@phx.gbl>
<D1**************@cpmsftngxa07.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Tue, 16 Sep 2003 08:53:28 -0700 Lines: 194 Message-ID: <44****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Thread-Index: AcN8aqu/CHFvOvYgS9yJEoPDHDC/PQ== X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa07.phx.gbl Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:108452 NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165 X-Tomcat-NG: microsoft.public.dotnet.general
The replies by both you and Steven are good as far as they go. They explain that it is possible on the server side to create and then register a client script.
That means that a user could click a button that would postback a request for information. If you wish to return the info in a pop-up, non-modal window, you could generate a script to initiate the popup.
Of course you are still left with the problem of how that script gets invoked. Having the user press ANOTHER button is clearly not acceptable. Using an event such as 'onload' is only useful if there is some way for the script to determine what/when it is to take action. The 'onload' event would fire everytime the page was invoked, but the window.open would be discretionary. There needs to be some mechanism to pass a message between server and client in order for the script to know what to do.
The obvious possibility would be in a hidden input control. But the client side script seems to have trouble reading the hidden control, especially if the control is encapsulated in a User Control. It seems the User Control compile process pre-pends the id of the User Control to the control id, but the script can't use that name. So there doesn't seem to be any way for the script to read the value of the hidden control.
This make the proposed solution either extremely difficult or perhaps impossible. Perhaps the correct approach is to write a Server Control. That seems like an unnecessarily complex approach, but may be the correct way to approach this. Perhaps User Controls are best thought of as Server- side includes.
HarveyB
-----Original Message----- Hi Harveyb,
Since the Browser/Server modal is based on request. That is to say, theserver will response to client browser with the html code at last when theclient make a request. The server can not actively generate the html file (i.e. javascript )without the browser request. Have you check the suggestion of Steven, it is one method to invoke thejavascript in code behind? Have you also check my last post that can handle the click event in thedatalist in my last post?
Did I answer your question? If you have any related question,please feel free to let me know. Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. --------------------Content-Class: urn:content-classes:message From: "Harveyb" <ha*****@panix.com> Sender: "Harveyb" <ha*****@panix.com> References: <01****************************@phx.gbl> <uK*************@TK2MSFTNGP12.phx.gbl> <02****************************@phx.gbl> <jo**************@cpmsftngxa06.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Mon, 15 Sep 2003 14:20:54 -0700 Lines: 85 Message-ID: <05****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Thread-Index: AcN7zz9LPdhNaOMyRCub/9yArgi1YA== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa07.phx.gbl Xref: cpmsftngxa07.phx.gblmicrosoft.public.dotnet.general:108301NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
Ok, then is there a way to pass a message (of some type) to the client side so that a client side javascript canbefired to open the window.
I mean 'message' in the most generic meaning of theterm.I just want some way to detect the button click insidetheDatalist, handle the event on the server-side and then hand it off to the client side. The reason for this issothat the menu inside the datalist control can be dynamic and based on either an XML file or a SQL Query.
It seems that this should be easy, but I have triedquitea few ideas without success.
-----Original Message----- Hi HarveyB,
I do not believe that there is a method to open aclientwindow without using the client script. For security concern, it is non-security to open awindowfrom server-side. Did I answer your question?
Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
-------------------- >Content-Class: urn:content-classes:message >From: "HarveyB" <ha*****@compass-soft.com> >Sender: "HarveyB" <ha*****@compass-soft.com> >References: <01****************************@phx.gbl> <uK*************@TK2MSFTNGP12.phx.gbl> >Subject: Re: Popup Window generated from Server Side >Date: Wed, 10 Sep 2003 17:50:25 -0700 >Lines: 23 >Message-ID: <02****************************@phx.gbl> >MIME-Version: 1.0 >Content-Type: text/plain; > charset="iso-8859-1" >Content-Transfer-Encoding: 7bit >X-Newsreader: Microsoft CDO for Windows 2000 >Thread-Index: AcN3/rAw3yfjfbmGRFOdbtTXl0V14A== >X-MimeOLE: Produced By Microsoft MimeOLEV5.50.4910.0300>Newsgroups: microsoft.public.dotnet.general >Path: cpmsftngxa06.phx.gbl >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:108058 >NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 >X-Tomcat-NG: microsoft.public.dotnet.general > > >>-----Original Message----- >> >>"HarveyB" <ha*****@compass-soft.com> wrote in message >>news:01****************************@phx.gbl. .. >>> I would like to generate non-modal popup windowsfrom>>> ASP.Net code-behind. >> >>How about using Response.Write in your server sidecode:>> >>Response.Write("<script language='javascript'>window.open >(....)</script>"); >> >>--- >>Steven Wood >> >I don't think that solves the problem. It will placea>script on the returned page, but how is the script invoked >from the Server Side. The issue here is to open a pop- up >window from the server side. 'Window' is a client-side>object. > >Harvey Bernstein >
.
.
I have developed a popup control to accomplish what you want. It will
open a child window and responds to postback events. It can be placed
on an ASP.NET page like this:
<PowerUI:Popup id="pPopup" runat="Server" PopupWidth="300px"
PopupHeight="300px" OnPopupPostBack="pPopup_PostBack"
UrlToPop="UserEdit.aspx">Edit</PowerUI:Popup>
Clicking on "Edit" will open the the page UserEdit.aspx in a window.
The child window can also be opened by issuing:
pPopup.PopupWindow();
in the code-behind....
Notice that you can subscribe a method to the event "OnPopupPostBack".
This is fired from executing the static method on the child window
code-behind like this:
Popup.CloseWindow(Page,true,"PostBack Message",true);
The parameters are as follows:
1. Current "Page" object
2. Fire postback event on Parent Page
3. Optional argument in case you want to pass something back to the
parent page
4. Close the child window after postback.
This can be used in a data list or datagrid for popping up edit/detail
windows. To use the Popup control in a datagrid might look like this:
<asp:DataGrid id="dgGrid" runat="server">
<columns>
<asp:TemplateColumn>
<ItemTemplate>
<PowerUI:Popup id="pEdit" runat="server"
OnPopupPostBack="pEdit_PostBack" UrlToPop='<%# "UserEdit.aspx?UserID="
+ ((User)Container.DataItem).UserID %>'>Edit</PowerUI:Popup>
</ItemTemplate>
</asp:TemplateColumn>
</columns>
</asp:DataGrid>
If your interested in the control I can email to you as an Alpha
version. I will be selling the control soon so I will not be
providing source code...
I will examine your sample code as to it appicability to
communicating between Server and Client.
As to the original topic, we were on the right track. It
only required a slight twist. If one creates and
registers JavaScript code on the Server Side, but does NOT
wrap it in a function, the registered code will execute as
inline script after Page_Load. This does allow a popup
window to be invoked from the Server-Side. I have tested
this in IE and Netscape.
Thx, I consider the original issue closed. I may wish to
pursue the issue of messaging between server & client in a
new thread.
Harvey -----Original Message----- Hi Harveyb,
For the design of Browser/Server modal, I think you may
use a javascriptfunction to restrieve the message from server repeatedly. e.g. You have two pages. page1: the main page you show the datalist to the client. page2: the page used to response the message to client
just as you "push"the message to the client. a javascript function run repeatedly to retrieve the data
from page2. function querystatus() { GetXMLHTTP();//a customer function to retrieve the msg
the server wantto response to the client. setTimeout(querystatus,300); }
For detailed information, please refer to the link below. http://groups.google.com/groups?q=%22lewis+wang%
22+activeXobject&hl=zh-CN&lr=&ie=UTF-8&oe=UTF-8&selm=%249sGgp0YDHA.2172%
40cpmsftngxa06.phx.gbl&rnum=1 Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. --------------------Content-Class: urn:content-classes:message From: "HarveyB" <ha*****@panix.com> Sender: "HarveyB" <ha*****@panix.com> References: <01****************************@phx.gbl> <uK*************@TK2MSFTNGP12.phx.gbl> <02****************************@phx.gbl> <jo**************@cpmsftngxa06.phx.gbl> <05****************************@phx.gbl> <D1**************@cpmsftngxa07.phx.gbl>Subject: Re: Popup Window generated from Server Side Date: Tue, 16 Sep 2003 08:53:28 -0700 Lines: 194 Message-ID: <44****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 Thread-Index: AcN8aqu/CHFvOvYgS9yJEoPDHDC/PQ== X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa07.phx.gbl Xref: cpmsftngxa07.phx.gbl
microsoft.public.dotnet.general:108452NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165 X-Tomcat-NG: microsoft.public.dotnet.general
The replies by both you and Steven are good as far as
theygo. They explain that it is possible on the server side to create and then register a client script.
That means that a user could click a button that would postback a request for information. If you wish to
returnthe info in a pop-up, non-modal window, you could
generatea script to initiate the popup.
Of course you are still left with the problem of how
thatscript gets invoked. Having the user press ANOTHER
buttonis clearly not acceptable. Using an event such as 'onload' is only useful if there is some way for the script to determine what/when it is to take action. The 'onload' event would fire everytime the page was invoked, but the window.open would be discretionary. There needs to be some mechanism to pass a message
betweenserver and client in order for the script to know what
todo.
The obvious possibility would be in a hidden input control. But the client side script seems to have
troublereading the hidden control, especially if the control is encapsulated in a User Control. It seems the User
Controlcompile process pre-pends the id of the User Control to the control id, but the script can't use that name. So there doesn't seem to be any way for the script to read the value of the hidden control.
This make the proposed solution either extremely
difficultor perhaps impossible. Perhaps the correct approach is
towrite a Server Control. That seems like an
unnecessarilycomplex approach, but may be the correct way to approach this. Perhaps User Controls are best thought of as
Server-side includes.
HarveyB
-----Original Message----- Hi Harveyb,
Since the Browser/Server modal is based on request.
Thatis to say, theserver will response to client browser with the html
codeat last when theclient make a request. The server can not actively generate the html file
(i.e.javascript )without the browser request. Have you check the suggestion of Steven, it is one
methodto invoke thejavascript in code behind? Have you also check my last post that can handle the click event in thedatalist in my last post?
Did I answer your question? If you have any related question,please feel free to
letme know. Regards, Peter Huang Microsoft Online Partner Support Get Secure! www.microsoft.com/security This posting is provided "as is" with no warranties and
confers no rights. -------------------- Content-Class: urn:content-classes:message From: "Harveyb" <ha*****@panix.com> Sender: "Harveyb" <ha*****@panix.com> References: <01****************************@phx.gbl> <uK*************@TK2MSFTNGP12.phx.gbl> <02****************************@phx.gbl> <jo**************@cpmsftngxa06.phx.gbl> Subject: Re: Popup Window generated from Server Side Date: Mon, 15 Sep 2003 14:20:54 -0700 Lines: 85 Message-ID: <05****************************@phx.gbl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft CDO for Windows 2000 X-MimeOLE: Produced By Microsoft MimeOLE
V5.50.4910.0300Thread-Index: AcN7zz9LPdhNaOMyRCub/9yArgi1YA== Newsgroups: microsoft.public.dotnet.general Path: cpmsftngxa07.phx.gbl Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:108301NNTP-Posting-Host: tk2msftngxa11.phx.gbl 10.40.1.163 X-Tomcat-NG: microsoft.public.dotnet.general
Ok, then is there a way to pass a message (of some
type)to the client side so that a client side javascript
canbefired to open the window.
I mean 'message' in the most generic meaning of the term.I just want some way to detect the button click inside theDatalist, handle the event on the server-side and then hand it off to the client side. The reason for this
issothat the menu inside the datalist control can be
dynamicand based on either an XML file or a SQL Query.
It seems that this should be easy, but I have tried quitea few ideas without success.
>-----Original Message----- >Hi HarveyB, > >I do not believe that there is a method to open a clientwindow without >using the client script. >For security concern, it is non-security to open a windowfrom server-side. >Did I answer your question? > >Regards, >Peter Huang >Microsoft Online Partner Support >Get Secure! www.microsoft.com/security >This posting is provided "as is" with no warranties
andconfers no rights. > >-------------------- >>Content-Class: urn:content-classes:message >>From: "HarveyB" <ha*****@compass-soft.com> >>Sender: "HarveyB" <ha*****@compass-soft.com> >>References: <01****************************@phx.gbl> ><uK*************@TK2MSFTNGP12.phx.gbl> >>Subject: Re: Popup Window generated from Server Side >>Date: Wed, 10 Sep 2003 17:50:25 -0700 >>Lines: 23 >>Message-ID: <02****************************@phx.gbl> >>MIME-Version: 1.0 >>Content-Type: text/plain; >> charset="iso-8859-1" >>Content-Transfer-Encoding: 7bit >>X-Newsreader: Microsoft CDO for Windows 2000 >>Thread-Index: AcN3/rAw3yfjfbmGRFOdbtTXl0V14A== >>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300>>Newsgroups: microsoft.public.dotnet.general >>Path: cpmsftngxa06.phx.gbl >>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:108058 >>NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165 >>X-Tomcat-NG: microsoft.public.dotnet.general >> >> >>>-----Original Message----- >>> >>>"HarveyB" <ha*****@compass-soft.com> wrote in
message>>>news:01****************************@phx.gbl ... >>>> I would like to generate non-modal popup windows from>>>> ASP.Net code-behind. >>> >>>How about using Response.Write in your server side code:>>> >>>Response.Write("<script language='javascript'>window.open >>(....)</script>"); >>> >>>--- >>>Steven Wood >>> >>I don't think that solves the problem. It will
placea>>script on the returned page, but how is the script invoked >>from the Server Side. The issue here is to open a
pop-up >>window from the server side. 'Window' is a client- side>>object. >> >>Harvey Bernstein >> > >. >
.
. This discussion thread is closed Replies have been disabled for this discussion. Similar topics
1 post
views
Thread by William Starr Moake |
last post: by
|
4 posts
views
Thread by Davey |
last post: by
|
1 post
views
Thread by Earl Teigrob |
last post: by
|
7 posts
views
Thread by Drew Berkemeyer |
last post: by
|
4 posts
views
Thread by Raed Sawalha |
last post: by
|
12 posts
views
Thread by HarveyB |
last post: by
|
8 posts
views
Thread by Jeff User |
last post: by
|
2 posts
views
Thread by VMI |
last post: by
| | | | | | | | | | |