473,394 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

User Message

Hi I want to pop up a little window (sort of a message
box), so I call MessageBoxA function during postback, and
I get "error on page" icon. What's the way to popup a new
window? Thanks!
public static void MessageBoxA(string message)
{
HttpContext.Current.Response.Write("<script
language='javascript'>");
string writestring = "myWindow = window.open(\"\",
\"tinyWindow\", 'toolbar,width=150,height=100');"+
"myWindow.document.write(\"" + message + "\");" +
"myWindow.document.bgColor=\"lightblue\";" +
"myWindow.document.close(); ";

HttpContext.Current.Response.Write(writestring);
HttpContext.Current.Response.Write("</script>");

}
Nov 17 '05 #1
7 1592
You either have to create a new browser window, or use the javascript alert
method

See below for some examples
--
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 type="button" value="ClickMe" onclick="DoClick()">
</form>
</body>
</html>

<html>
<head>
<script language="VB" runat="server">

Sub button_onClick( sender as Object,e as EventArgs)
Response.Write("Postback as requested!!!")
End Sub
</script>
</head>

<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">

<input type="button" value="OK" onserverclick="button_onClick"
onclick="if(!confirm('You wanna do the postback?')){return false;}"
runat="server">
</form>
</body>
</html>


"szabelin" <szabelin@szabelin> wrote in message
news:03****************************@phx.gbl...
Hi I want to pop up a little window (sort of a message
box), so I call MessageBoxA function during postback, and
I get "error on page" icon. What's the way to popup a new
window? Thanks!
public static void MessageBoxA(string message)
{
HttpContext.Current.Response.Write("<script
language='javascript'>");
string writestring = "myWindow = window.open(\"\",
\"tinyWindow\", 'toolbar,width=150,height=100');"+
"myWindow.document.write(\"" + message + "\");" +
"myWindow.document.bgColor=\"lightblue\";" +
"myWindow.document.close(); ";

HttpContext.Current.Response.Write(writestring);
HttpContext.Current.Response.Write("</script>");

}

Nov 17 '05 #2
Hello John, thanks for reply. So I am going to
RegisterClientScriptBlock - but how do I simulate a call
to fucntion "DoClick" from your example - my popup is not
a result of a button click, rather it depends on some
processing I do first in response to a postback

Thank you
S
-----Original Message-----
You either have to create a new browser window, or use the javascript alertmethod

See below for some examples
--
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 type="button" value="ClickMe" onclick="DoClick()"> </form>
</body>
</html>

<html>
<head>
<script language="VB" runat="server">

Sub button_onClick( sender as Object,e as EventArgs)
Response.Write("Postback as requested!!!")
End Sub
</script>
</head>

<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">

<input type="button" value="OK" onserverclick="button_onClick" onclick="if(!confirm('You wanna do the postback?')) {return false;}" runat="server">
</form>
</body>
</html>


"szabelin" <szabelin@szabelin> wrote in message
news:03****************************@phx.gbl...
Hi I want to pop up a little window (sort of a message
box), so I call MessageBoxA function during postback, and I get "error on page" icon. What's the way to popup a new window? Thanks!
public static void MessageBoxA(string message)
{
HttpContext.Current.Response.Write("<script
language='javascript'>");
string writestring = "myWindow = window.open(\"\",
\"tinyWindow\", 'toolbar,width=150,height=100');"+
"myWindow.document.write(\"" + message + "\");" +
"myWindow.document.bgColor=\"lightblue\";" +
"myWindow.document.close(); ";

HttpContext.Current.Response.Write(writestring);
HttpContext.Current.Response.Write("</script>");

}

.

Nov 17 '05 #3
you should avoid this approach, as pop ad blockers will prevent your window
from appearing.
-- bruce (sqlwork.com)

"szabelin" <szabelin@szabelin> wrote in message
news:07****************************@phx.gbl...
Hello John, thanks for reply. So I am going to
RegisterClientScriptBlock - but how do I simulate a call
to fucntion "DoClick" from your example - my popup is not
a result of a button click, rather it depends on some
processing I do first in response to a postback

Thank you
S
-----Original Message-----
You either have to create a new browser window, or use

the javascript alert
method

See below for some examples
--
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 type="button" value="ClickMe"

onclick="DoClick()">
</form>
</body>
</html>

<html>
<head>
<script language="VB" runat="server">

Sub button_onClick( sender as Object,e as EventArgs)
Response.Write("Postback as requested!!!")
End Sub
</script>
</head>

<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">

<input type="button" value="OK"

onserverclick="button_onClick"
onclick="if(!confirm('You wanna do the postback?'))

{return false;}"
runat="server">
</form>
</body>
</html>


"szabelin" <szabelin@szabelin> wrote in message
news:03****************************@phx.gbl...
Hi I want to pop up a little window (sort of a message
box), so I call MessageBoxA function during postback, and I get "error on page" icon. What's the way to popup a new window? Thanks!
public static void MessageBoxA(string message)
{
HttpContext.Current.Response.Write("<script
language='javascript'>");
string writestring = "myWindow = window.open(\"\",
\"tinyWindow\", 'toolbar,width=150,height=100');"+
"myWindow.document.write(\"" + message + "\");" +
"myWindow.document.bgColor=\"lightblue\";" +
"myWindow.document.close(); ";

HttpContext.Current.Response.Write(writestring);
HttpContext.Current.Response.Write("</script>");

}

.

Nov 17 '05 #4
They may well do that..mine certainly does, but they dont tend to stop
Javacript alerts easily and there are few options for popping to the screen.

All the button click example does is call a local (client) javascript
function, so you could call this in HTML body onload event, or wherever you
choose. You will still need to send the script as part of your page
response and call it.

--
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>
----------------------------------------------

"bruce barker" <no***********@safeco.com> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
you should avoid this approach, as pop ad blockers will prevent your window from appearing.
-- bruce (sqlwork.com)

"szabelin" <szabelin@szabelin> wrote in message
news:07****************************@phx.gbl...
Hello John, thanks for reply. So I am going to
RegisterClientScriptBlock - but how do I simulate a call
to fucntion "DoClick" from your example - my popup is not
a result of a button click, rather it depends on some
processing I do first in response to a postback

Thank you
S
-----Original Message-----
You either have to create a new browser window, or use

the javascript alert
method

See below for some examples
--
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 type="button" value="ClickMe"

onclick="DoClick()">
</form>
</body>
</html>

<html>
<head>
<script language="VB" runat="server">

Sub button_onClick( sender as Object,e as EventArgs)
Response.Write("Postback as requested!!!")
End Sub
</script>
</head>

<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">

<input type="button" value="OK"

onserverclick="button_onClick"
onclick="if(!confirm('You wanna do the postback?'))

{return false;}"
runat="server">
</form>
</body>
</html>


"szabelin" <szabelin@szabelin> wrote in message
news:03****************************@phx.gbl...
> Hi I want to pop up a little window (sort of a message
> box), so I call MessageBoxA function during postback,

and
> I get "error on page" icon. What's the way to popup a

new
> window? Thanks!
>
>
> public static void MessageBoxA(string message)
> {
> HttpContext.Current.Response.Write("<script
> language='javascript'>");
> string writestring = "myWindow = window.open(\"\",
> \"tinyWindow\", 'toolbar,width=150,height=100');"+
> "myWindow.document.write(\"" + message + "\");" +
> "myWindow.document.bgColor=\"lightblue\";" +
> "myWindow.document.close(); ";
>
> HttpContext.Current.Response.Write(writestring);
> HttpContext.Current.Response.Write("</script>");
>
> }
.


Nov 17 '05 #5

I am sorry - again - how do you call a popup (javascript
fuction) from the C# code in asp.net application. I got
the registration part. Thanks John.

-----Original Message-----
They may well do that..mine certainly does, but they dont tend to stopJavacript alerts easily and there are few options for popping to the screen.
All the button click example does is call a local (client) javascriptfunction, so you could call this in HTML body onload event, or wherever youchoose. You will still need to send the script as part of your pageresponse and call it.

--
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>
----------------------------------------------

"bruce barker" <no***********@safeco.com> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
you should avoid this approach, as pop ad blockers will
prevent yourwindow
from appearing.
-- bruce (sqlwork.com)

"szabelin" <szabelin@szabelin> wrote in message
news:07****************************@phx.gbl...
> Hello John, thanks for reply. So I am going to
> RegisterClientScriptBlock - but how do I simulate a call > to fucntion "DoClick" from your example - my popup is not > a result of a button click, rather it depends on some
> processing I do first in response to a postback
>
> Thank you
> S
>
> >-----Original Message-----
> >You either have to create a new browser window, or use > the javascript alert
> >method
> >
> >See below for some examples
> >--
> >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 type="button" value="ClickMe"
> onclick="DoClick()">
> > </form>
> > </body>
> ></html>
> >
> ><html>
> > <head>
> > <script language="VB" runat="server">
> >
> > Sub button_onClick( sender as Object,e as EventArgs) > > Response.Write("Postback as requested!!!")
> > End Sub
> >
> >
> > </script>
> > </head>
> >
> > <body topmargin="20" leftmargin="10">
> > <form id="myForm" runat="server">
> >
> > <input type="button" value="OK"
> onserverclick="button_onClick"
> > onclick="if(!confirm('You wanna do the postback?'))
> {return false;}"
> > runat="server">
> >
> >
> > </form>
> > </body>
> ></html>
> >
> >
> >
> >
> >"szabelin" <szabelin@szabelin> wrote in message
> >news:03****************************@phx.gbl...
> >> Hi I want to pop up a little window (sort of a message > >> box), so I call MessageBoxA function during postback, > and
> >> I get "error on page" icon. What's the way to popup a > new
> >> window? Thanks!
> >>
> >>
> >> public static void MessageBoxA(string message)
> >> {
> >> HttpContext.Current.Response.Write("<script
> >> language='javascript'>");
> >> string writestring = "myWindow = window.open(\"\",
> >> \"tinyWindow\", 'toolbar,width=150,height=100');"+
> >> "myWindow.document.write(\"" + message + "\");" +
> >> "myWindow.document.bgColor=\"lightblue\";" +
> >> "myWindow.document.close(); ";
> >>
> >> HttpContext.Current.Response.Write (writestring); > >> HttpContext.Current.Response.Write("</script>");
> >>
> >> }
> >
> >
> >.
> >


.

Nov 17 '05 #6
Ram
Your javascript is not correct, try this.

public static void MessageBoxA(string message)
{
HttpContext.Current.Response.Write("<script language='javascript'>");
string writestring =
"myWindow = window.open'','tinyWindow','toolbar,width=150,heig ht=100');"+
"myWindow.document.write('" + message + "');" +
"myWindow.document.bgColor='lightblue';" +
"myWindow.document.close(); ";

HttpContext.Current.Response.Write(writestring);
HttpContext.Current.Response.Write("</script>");

}

Hope this helps.
Ram.

"szabelin" <szabelin@szabelin> wrote in message news:<02****************************@phx.gbl>...
It's a corporat intranet, popups are a requirement. You
have the answer to my q? Thanks
-----Original Message-----
you should avoid this approach, as pop ad blockers will

prevent your window
from appearing.
-- bruce (sqlwork.com)

"szabelin" <szabelin@szabelin> wrote in message
news:07****************************@phx.gbl...
Hello John, thanks for reply. So I am going to
RegisterClientScriptBlock - but how do I simulate a call
to fucntion "DoClick" from your example - my popup is not a result of a button click, rather it depends on some
processing I do first in response to a postback

Thank you
S

>-----Original Message-----
>You either have to create a new browser window, or use the javascript alert >method
>
>See below for some examples
>--
>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 type="button" value="ClickMe" onclick="DoClick()"> > </form>
> </body>
></html>
>
><html>
> <head>
> <script language="VB" runat="server">
>
> Sub button_onClick( sender as Object,e as EventArgs)
> Response.Write("Postback as requested!!!")
> End Sub
>
>
> </script>
> </head>
>
> <body topmargin="20" leftmargin="10">
> <form id="myForm" runat="server">
>
> <input type="button" value="OK" onserverclick="button_onClick" > onclick="if(!confirm('You wanna do the postback?')) {return false;}" > runat="server">
>
>
> </form>
> </body>
></html>
>
>
>
>
>"szabelin" <szabelin@szabelin> wrote in message
>news:03****************************@phx.gbl...
>> Hi I want to pop up a little window (sort of a message >> box), so I call MessageBoxA function during postback, and >> I get "error on page" icon. What's the way to popup a new >> window? Thanks!
>>
>>
>> public static void MessageBoxA(string message)
>> {
>> HttpContext.Current.Response.Write("<script
>> language='javascript'>");
>> string writestring = "myWindow = window.open(\"\",
>> \"tinyWindow\", 'toolbar,width=150,height=100');"+
>> "myWindow.document.write(\"" + message + "\");" +
>> "myWindow.document.bgColor=\"lightblue\";" +
>> "myWindow.document.close(); ";
>>
>> HttpContext.Current.Response.Write(writestring);
>> HttpContext.Current.Response.Write("</script>");
>>
>> }
>
>
>.
>

.

Nov 17 '05 #7
you cant call it from C# - you cant popup windows server side, which is what
would happen if you could do this in C#. You have to do this in the browser
as part of the response, and get the browser to do whatever it is you need
using javascript.

--
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>
----------------------------------------------

"szabelin" <szabelin@szabelin> wrote in message
news:02****************************@phx.gbl...

I am sorry - again - how do you call a popup (javascript
fuction) from the C# code in asp.net application. I got
the registration part. Thanks John.

-----Original Message-----
They may well do that..mine certainly does, but they dont

tend to stop
Javacript alerts easily and there are few options for

popping to the screen.

All the button click example does is call a local

(client) javascript
function, so you could call this in HTML body onload

event, or wherever you
choose. You will still need to send the script as part

of your page
response and call it.

--
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>
----------------------------------------------

"bruce barker" <no***********@safeco.com> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
you should avoid this approach, as pop ad blockers will prevent your
window
from appearing.
-- bruce (sqlwork.com)

"szabelin" <szabelin@szabelin> wrote in message
news:07****************************@phx.gbl...
> Hello John, thanks for reply. So I am going to
> RegisterClientScriptBlock - but how do I simulate a

call > to fucntion "DoClick" from your example - my popup is not > a result of a button click, rather it depends on some
> processing I do first in response to a postback
>
> Thank you
> S
>
> >-----Original Message-----
> >You either have to create a new browser window, or use > the javascript alert
> >method
> >
> >See below for some examples
> >--
> >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 type="button" value="ClickMe"
> onclick="DoClick()">
> > </form>
> > </body>
> ></html>
> >
> ><html>
> > <head>
> > <script language="VB" runat="server">
> >
> > Sub button_onClick( sender as Object,e as EventArgs) > > Response.Write("Postback as requested!!!")
> > End Sub
> >
> >
> > </script>
> > </head>
> >
> > <body topmargin="20" leftmargin="10">
> > <form id="myForm" runat="server">
> >
> > <input type="button" value="OK"
> onserverclick="button_onClick"
> > onclick="if(!confirm('You wanna do the postback?'))
> {return false;}"
> > runat="server">
> >
> >
> > </form>
> > </body>
> ></html>
> >
> >
> >
> >
> >"szabelin" <szabelin@szabelin> wrote in message
> >news:03****************************@phx.gbl...
> >> Hi I want to pop up a little window (sort of a message > >> box), so I call MessageBoxA function during postback, > and
> >> I get "error on page" icon. What's the way to popup a > new
> >> window? Thanks!
> >>
> >>
> >> public static void MessageBoxA(string message)
> >> {
> >> HttpContext.Current.Response.Write("<script
> >> language='javascript'>");
> >> string writestring = "myWindow = window.open(\"\",
> >> \"tinyWindow\", 'toolbar,width=150,height=100');"+
> >> "myWindow.document.write(\"" + message + "\");" +
> >> "myWindow.document.bgColor=\"lightblue\";" +
> >> "myWindow.document.close(); ";
> >>
> >> HttpContext.Current.Response.Write (writestring); > >> HttpContext.Current.Response.Write("</script>");
> >>
> >> }
> >
> >
> >.
> >

.

Nov 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another...
5
by: Michelle Stone | last post by:
Hi everybody I am writing a simple asp.net application using form authentication. I store the list of all users and their passwords in an SQL Server database table. My client recently told me...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
5
by: Dave Kolb | last post by:
Is there any other solution for an ASPNET application to access network resources other than running as SYSTEM, using delegation (a nightmare to get to work) or the COM+ solution? I cannot seem to...
5
by: Bruno Mendonça | last post by:
My boss asked me to build a program to create a report with logon/logoff events for all users within our windows domain. I'm using .Net to do so and decided to have a program running on the Domain...
8
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
8
by: Joe | last post by:
I check for the NTLogin of a user by Page.User.Identity.Name, but when I put the app on the server the value for Page.User.Identity.Name is "" I had the <allow users="*/> attribute commented...
9
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
6
by: Andrew Chalk | last post by:
My application attempts to connect to an SQL Server database as name ASPNET and Login Name SERVERNAME/ASPNET in response to these commands: SqlConnection myConnection = new SqlConnection("Data...
14
by: chromis | last post by:
Hi, I've been trying to implement a more OOP oriented approach to dealing with user security on one of my websites, and I am trying to validate the user against an array of roles, however I am...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.