message box:
The following code demonstrates the results of the alert
using a hidden input box, and javascript.
Do the following.
1. Create a webform and copy the following into the Load
function:
lblResult.Text = Request.Form("R eturnValue")
2. Switch to html view and copy the following from <html>
tag to </html> tag:
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " content="Micros oft
Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual
Basic .NET 7.1">
<meta name="vs_defaul tClientScript"
content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
<Script language="javas cript">
function AskQuestion()
{
if (confirm('Quest ion
Here')) //Yes clicked if true
{
document.Form1. ReturnValue.val ue = "YES";
}
else // No clicked
{
document.Form1. ReturnValue.val ue = "NO";
}
return true;
}
</Script>
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post"
runat="server">
<INPUT name="ReturnVal ue"
id="ReturnValue " style="Z-INDEX: 101; LEFT: 91px; WIDTH:
206px; POSITION: absolute; TOP: 85px; HEIGHT: 27px"
type="hidden" size="29">
<asp:Label id="lblResult" style="Z-
INDEX: 102; LEFT: 95px; POSITION: absolute; TOP: 51px"
runat="server"
Width="199px"></asp:Label>
<INPUT style="Z-INDEX: 103; LEFT:
88px; WIDTH: 269px; POSITION: absolute; TOP: 164px;
HEIGHT: 32px"
type="submit"
onclick="AskQue stion();" value="Submit">
</form>
</body>
</HTML>
3. Run it and click the button.
4. Look at the html to see how it works. It is pretty
simple.
HTH,
Billy Jacobs
-----Original Message-----
How can I get MessageBox in the WebForms?
I would like to display yes/no messagebox and wanted to
capture what value was clicked by the user(i.e., whether
yes or no).
.