messagebox

  • Thread starter Thread starter selen
  • Start date Start date
selen,

You can't really use the same thing. If you want to have a messagebox
show up on the client in a web application, then you have to have the server
output script to the client that will call the alert method on the inherent
window object that is exposed to the document by the browser. This will
bring up a messagebox. Of course, you have to wire it up to some sort of an
event, so you have to figure out when you want it to show up as well.

Hope this helps.
 
...........and to support Nicholas's answer an example can be found below
whihc pops an alert from a button click.


<html>
<head>
<script language="C#" runat="server">
void Page_Load( Object sender , EventArgs e )
{

//Form the script that is to be registered at client side.
string ScriptString = "<script language=JavaScript> function
DoClick() {";
ScriptString += "var truthBeTold = window.confirm('Click OK to
continue. Click Cancel to stop.');";
ScriptString += "if (truthBeTold)";
ScriptString += "window.alert('Welcome to MVP World!');";
ScriptString += "else window.alert('Bye from MVP World!');}<";
ScriptString += "/";
ScriptString += "script>";

if(! IsClientScriptBlockRegistered("clientScript"))
{
RegisterClientScriptBlock("clientScript", ScriptString);
}
}

</script>
</head>
<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">
<input type="button" value="ClickMe" onclick="DoClick()">
</form>
</body>
</html>

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

Nicholas Paldino said:
selen,

You can't really use the same thing. If you want to have a messagebox
show up on the client in a web application, then you have to have the server
output script to the client that will call the alert method on the inherent
window object that is exposed to the document by the browser. This will
bring up a messagebox. Of course, you have to wire it up to some sort of an
event, so you have to figure out when you want it to show up as well.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

selen said:
hello
how I can use messagebox as windows application in web application .
Thanks
 
Back
Top