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("ReturnValue")
2. Switch to html view and copy the following from <html>
tag to </html> tag:
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft
Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual
Basic .NET 7.1">
<meta name="vs_defaultClientScript"
content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<Script language="javascript">
function AskQuestion()
{
if (confirm('Question
Here')) //Yes clicked if true
{
document.Form1.ReturnValue.value = "YES";
}
else // No clicked
{
document.Form1.ReturnValue.value = "NO";
}
return true;
}
</Script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post"
runat="server">
<INPUT name="ReturnValue"
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="AskQuestion();" 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).
.