Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
<%@ Page AutoEventWireup="True" %>
<html>
<head>
<script language="C#" runat="server">
public void Button_Click (object sender, EventArgs e)
{
Random rand_number = new Random();
Compare1.ValueToCompare = rand_number.Next(1,10).ToString();
Compare1.Validate();
if (Page.IsValid)
lblOutput.Text = "You guessed correctly!!";
else
lblOutput.Text = "You guessed poorly";
lblOutput.Text += "<br><br>" + "The number is: " + Compare1.ValueToCompare;
}
</script>
</head>
<body>
<form runat=server>
<h3>Validator Example</h3>
<h5>Pick a number between 1 and 10:</h5>
<asp:TextBox id="TextBox1"
runat="server"/>
<asp:CompareValidator id="Compare1"
ControlToValidate="TextBox1"
ValueToCompare="0"
EnableClientScript="False"
Type="Integer"
Display="Dynamic"
ErrorMessage="Incorrect guess!!"
Text="*"
runat="server"/>
<asp:RequiredFieldValidator id="Require1"
ControlToValidate="TextBox1"
EnableClientScript="False"
Display="Dynamic"
ErrorMessage="No number entered!!"
Text="*"
runat="server"/>
<br><br>
<asp:Button id="Button1"
Text="Submit"
OnClick="Button_Click"
runat="server"/>
<br><br>
<asp:Label id="lblOutput"
Font-Name="verdana"
Font-Size="10pt"
runat="server"/>
<br><br>
<asp:ValidationSummary
id="Summary1"
runat="server"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,132 @@
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
void Button_Click(Object sender, EventArgs e)
{
if (Page.IsValid)
{
lblOutput.Text = "Result: Valid!";
}
else
{
lblOutput.Text = "Result: Not valid!";
}
}
void Operator_Index_Changed(Object sender, EventArgs e)
{
Compare1.Operator = (ValidationCompareOperator) ListOperator.SelectedIndex;
Compare1.Validate();
}
void Type_Index_Changed(Object sender, EventArgs e)
{
Compare1.Type = (ValidationDataType) ListType.SelectedIndex;
Compare1.Validate();
}
</script>
</head>
<body>
<form runat=server>
<h3>CompareValidator Example</h3>
<p>
Enter a value in each textbox. Select a comparison operator<br>
and data type. Click "Validate" to compare values.
<table bgcolor="#eeeeee" cellpadding=10>
<tr valign="top">
<td>
<h5>String 1:</h5>
<asp:TextBox id="TextBox1"
runat="server"/>
</td>
<td>
<h5>Comparison Operator:</h5>
<asp:ListBox id="ListOperator"
OnSelectedIndexChanged="Operator_Index_Changed"
runat="server">
<asp:ListItem Selected Value="Equal">Equal</asp:ListItem>
<asp:ListItem Value="NotEqual">NotEqual</asp:ListItem>
<asp:ListItem Value="GreaterThan">GreaterThan</asp:ListItem>
<asp:ListItem Value="GreaterThanEqual">GreaterThanEqual</asp:ListItem>
<asp:ListItem Value="LessThan">LessThan</asp:ListItem>
<asp:ListItem Value="LessThanEqual">LessThanEqual</asp:ListItem>
<asp:ListItem Value="DataTypeCheck">DataTypeCheck</asp:ListItem>
</asp:ListBox>
</td>
<td>
<h5>String 2:</h5>
<asp:TextBox id="TextBox2"
runat="server"/>
<p>
<asp:Button id="Button1"
Text="Validate"
OnClick="Button_Click"
runat="server"/>
</td>
</tr>
<tr>
<td colspan="3" align="center">
<h5>Data Type:</h5>
<asp:ListBox id="ListType"
OnSelectedIndexChanged="Type_Index_Changed"
runat="server">
<asp:ListItem Selected Value="String" >String</asp:ListItem>
<asp:ListItem Value="Integer" >Integer</asp:ListItem>
<asp:ListItem Value="Double" >Double</asp:ListItem>
<asp:ListItem Value="Date" >Date</asp:ListItem>
<asp:ListItem Value="Currency" >Currency</asp:ListItem>
</asp:ListBox>
</td>
</tr>
</table>
<asp:CompareValidator id="Compare1"
ControlToValidate="TextBox1"
ControlToCompare="TextBox2"
EnableClientScript="False"
Type="String"
runat="server"/>
<br>
<asp:Label id="lblOutput"
Font-Name="verdana"
Font-Size="10pt"
runat="server"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,31 @@
<html>
<body>
<form runat="server">
<table border="0" bgcolor="#b0c4de">
<tr valign="top">
<td colspan="4"><h4>Compare two values</h4></td>
</tr>
<tr valign="top">
<td><asp:TextBox id="txt1" runat="server" /></td>
<td> = </td>
<td><asp:TextBox id="txt2" runat="server" /></td>
<td><asp:Button Text="Validate" runat="server" /></td>
</tr>
</table>
<br />
<asp:CompareValidator
id="compval"
Display="dynamic"
ControlToValidate="txt1"
ControlToCompare="txt2"
ForeColor="red"
BackColor="yellow"
Type="String"
EnableClientScript="false"
Text="Validation Failed!"
runat="server" />
</form>
</body>
</html>

View File

@@ -0,0 +1,43 @@
<script runat="server">
public void check_operator (object sender, EventArgs e) {
compval.Operator = (ValidationCompareOperator)list.SelectedIndex;
compval.Validate();
}
</script>
<html>
<body>
<form runat="server">
<table border="0" bgcolor="#b0c4de">
<tr valign="top">
<td colspan="4"><h4>Compare two values</h4></td>
</tr>
<tr valign="top">
<td><asp:TextBox id="txt1" runat="server" /></td>
<td>
<asp:ListBox id="list" rows="2" OnSelectedIndexChanged="check_operator" runat="server">
<asp:ListItem value="Equal" selected>=</asp:ListItem>
<asp:ListItem value="NotEqual"><></asp:ListItem>
</asp:ListBox>
</td>
<td><asp:TextBox id="txt2" runat="server" /></td>
<td><asp:Button Text="Validate" runat="server" /></td>
</tr>
</table>
<br />
<asp:CompareValidator
id="compval"
Display="dynamic"
ControlToValidate="txt1"
ControlToCompare="txt2"
ForeColor="red"
BackColor="yellow"
Type="String"
EnableClientScript="false"
Text="Validation Failed!"
runat="server" />
</form>
</body>
</html>

View File

@@ -0,0 +1,78 @@
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
void ValidateBtn_Click(Object sender, EventArgs e)
{
if (Page.IsValid)
{
lblOutput.Text = "Page is Valid!";
}
else
{
lblOutput.Text = "Page is InValid! :-(";
}
}
</script>
</head>
<body>
<h3>RegularExpressionValidator Example</h3>
<p>
<form runat="server">
<table bgcolor="#eeeeee" cellpadding="10">
<tr valign="top">
<td colspan="3">
<asp:Label ID="lblOutput"
Text="Enter a number greater than 50"
runat="server"/>
</td>
</tr>
<tr>
<td colspan="3">
<b>Information</b>
</td>
</tr>
<tr>
<td align="right">
Value:
</td>
<td>
<asp:TextBox id="TextBox1"
runat="server"/>
</td>
<td>
<asp:CompareValidator id="CompareValidator1"
ControlToValidate="TextBox1"
Operator="greaterthan"
Type="Integer"
ValueToCompare="xx"
Display="Static"
ErrorMessage="Value must be greater than 50"
EnableClientScript="true"
runat="server"/>
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button text="Validate"
OnClick="ValidateBtn_Click"
runat=server />
</td>
<td></td>
</tr>
</table>
</form>
</body>
</html>

View File

@@ -0,0 +1,64 @@
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
void ButtonClick(Object sender, EventArgs e)
{
if (Page.IsValid)
{
Label1.Text="Page is valid.";
}
else
{
Label1.Text="Page is not valid!!";
}
}
</script>
</head>
<body>
<form runat="server">
<h3>CustomValidator Example</h3>
Enter something
<br>
<asp:TextBox id="TextBox1"
runat="server"/>
<br>
<asp:CustomValidator id="Custom1"
ControlToValidate="TextBox1"
ClientValidationFunction="OhBabyValidateMe"
Text="Dude, watch what you're entering!"
runat="server"/>
<br><br>
<asp:Label id="Label1"
runat="server"/>
<br><br>
<asp:Button id="Button1"
Text="Submit"
OnClick="ButtonClick"
runat="server"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,36 @@
<%@ Page language="c#" AutoEventWireup="false" %>
<script runat="server" language="C#">
private void Test_OnClick(object Sender, EventArgs e)
{
Validate();
}
private void CustomValidator_ServerValidate(object Sender, ServerValidateEventArgs e)
{
e.IsValid = false;
}
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Mono CustomValidator Bug</title>
</head>
<body>
<form id="Form1" runat="server">
<asp:validationsummary runat="server" headertext="Validation errors should only display here"/>
<br>
<br>
After post back, Error Message should not display here: <asp:customvalidator runat="server" display="None" errormessage="Validator is not valid!" onservervalidate="CustomValidator_ServerValidate"/>
<br>
<br>
<asp:button runat="server" causesvalidation="True" Text="Test" onclick="Test_OnClick"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,29 @@
<html>
<head>
<script language="C#" runat=server>
void Click(object s, EventArgs e)
{
if (Page.IsValid == true)
lblOutput.Text = "PASS";
else
lblOutput.Text = "FAIL";
}
</script>
</head>
<body>
<form runat="server">
<p>
Just click validate. It should say pass.
</p>
<asp:label ID="lblOutput" runat=server /><br>
<asp:textbox id="t1" runat=server />
<asp:requiredfieldvalidator id="r1" ControlToValidate="t1" Enabled="false" runat="server" />
<asp:button id="b1" text="Validate" OnClick="Click" runat="server" />
</form>
</body>
</html>

View File

@@ -0,0 +1,34 @@
<%@ Page Language="C#" EnableViewState="false" %>
<%@ Import Namespace="System.Web.Security" %>
<html>
<script language="C#" runat=server>
void Login_Click (object sender, EventArgs e)
{
Console.WriteLine("In Login_Click");
if (IsPostBack == true && Page.IsValid)
{
Console.WriteLine("Before RedirectFromLoginPage: Name=" + name.Value);
FormsAuthentication.RedirectFromLoginPage(name.Value, PersistCookie.Checked);
}
else
Console.WriteLine("No IsPostBack or Page not valid");
}
</script>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="POST" action="login.aspx" runat="server">
<asp:ValidationSummary runat="server" HeaderText="Please fix the following errors:" />
Name: <input type="text" id="name" runat=server/></td><td><ASP:RequiredFieldValidator ControlToValidate="name"
Display="Static" ErrorMessage="Please enter a name" runat=server>*</ASP:RequiredFieldValidator>
<p />
Password:<asp:textbox id="password" textmode="password" runat="server" />
<p />
<ASP:CheckBox id=PersistCookie runat="server" checked="true" /> activate autologin
<p />
<asp:button text="Login" OnClick="Login_Click" runat=server/>
</form>
</body>
</html>

View File

@@ -0,0 +1,67 @@
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
void ButtonClick(Object sender, EventArgs e)
{
if (Page.IsValid)
{
Label1.Text="Page is valid.";
}
else
{
Label1.Text="Page is not valid!!";
}
}
</script>
</head>
<body>
<form runat="server">
<h3>RangeValidator Example</h3>
Enter a number from 1 to 10:
<br>
<asp:TextBox id="TextBox1"
runat="server"/>
<br>
<asp:RangeValidator id="Range1"
ControlToValidate="TextBox1"
MinimumValue="1"
MaximumValue="10"
Type="Integer"
EnableClientScript="false"
Text="The value must be from 1 to 10!"
runat="server"/>
<br><br>
<asp:Label id="Label1"
runat="server"/>
<br><br>
<asp:Button id="Button1"
Text="Submit"
OnClick="ButtonClick"
runat="server"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,76 @@
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
void ValidateBtn_Click(Object sender, EventArgs e)
{
if (Page.IsValid)
{
lblOutput.Text = "Page is Valid!";
}
else
{
lblOutput.Text = "Page is InValid! :-(";
}
}
</script>
</head>
<body>
<h3>RegularExpressionValidator Example</h3>
<p>
<form runat="server">
<table bgcolor="#eeeeee" cellpadding="10">
<tr valign="top">
<td colspan="3">
<asp:Label ID="lblOutput"
Text="Enter a 5 digit zip code"
runat="server"/>
</td>
</tr>
<tr>
<td colspan="3">
<b>Personal Information</b>
</td>
</tr>
<tr>
<td align="right">
Zip Code:
</td>
<td>
<asp:TextBox id="TextBox1"
runat="server"/>
</td>
<td>
<asp:RegularExpressionValidator id="RegularExpressionValidator1"
ControlToValidate="TextBox1"
ValidationExpression="\d{5}"
Display="Static"
ErrorMessage="Zip code must be 5 numeric digits"
EnableClientScript="True"
runat="server"/>
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button text="Validate"
OnClick="ValidateBtn_Click"
runat=server />
</td>
<td></td>
</tr>
</table>
</form>
</body>
</html>

View File

@@ -0,0 +1,100 @@
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>
<script runat="server">
void ButtonClick(Object sender, EventArgs e)
{
if (Page.IsValid)
{
Label.Text="Area is valid.";
}
else
{
Label.Text="Area is not valid!!";
}
}
</script>
</head>
<body>
<form runat="server">
<h3>Area 1</h3>
Enter a number from 1 to 10:
<br>
<asp:TextBox id="TextBox1"
runat="server"/>
<br>
<asp:RangeValidator id="Range1"
ValidationGroup="Area1"
ControlToValidate="TextBox1"
MinimumValue="1"
MaximumValue="10"
Type="Integer"
EnableClientScript="false"
Text="The value must be from 1 to 10!"
runat="server"/>
<br><br>
<asp:Label id="Label1"
runat="server"/>
<br><br>
<asp:Button id="Button1"
ValidationGroup="Area1"
Text="Submit"
OnClick="ButtonClick"
runat="server"/>
<h3>Area 2</h3>
Enter a number from 1 to 10:
<br>
<asp:TextBox id="TextBox1"
runat="server"/>
<br>
<asp:RangeValidator id="Range1"
ValidationGroup="Area2"
ControlToValidate="TextBox1"
MinimumValue="1"
MaximumValue="10"
Type="Integer"
EnableClientScript="false"
Text="The value must be from 1 to 10!"
runat="server"/>
<br><br>
<asp:Label id="Label1"
runat="server"/>
<br><br>
<asp:Button id="Button1"
ValidationGroup="Area2"
Text="Submit"
OnClick="ButtonClick"
runat="server"/>
</form>
</body>
</html>

View File

@@ -0,0 +1,50 @@
<html>
<body>
<form runat="server">
<asp:DropDownList id="DropDownList1" runat="server">
<asp:ListItem Value="">Please Choose</asp:ListItem>
<asp:ListItem Value="Bleep">Bleep</asp:ListItem>
<asp:ListItem Value="Blob">Blob</asp:ListItem>
<asp:ListItem Value="Blah">Blah</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator
id="RequiredFieldValidator1"
runat="server"
ErrorMessage="Please select an item in the DropDownList"
ControlToValidate="DropDownList1"
Display="None">
</asp:RequiredFieldValidator>
<asp:DropDownList id="DropDownList2" runat="server">
<asp:ListItem Value="">Please Choose A Second Item</asp:ListItem>
<asp:ListItem Value="Boing">Boing</asp:ListItem>
<asp:ListItem Value="Bump">Bump</asp:ListItem>
<asp:ListItem Value="Bing">Bing</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator
id="RequiredFieldValidator2"
runat="server"
ErrorMessage="Please select an item in the second DropDownList"
ControlToValidate="DropDownList2"
Display="None">
</asp:RequiredFieldValidator>
<asp:Button
id="Button1"
runat="server"
Text="Button">
</asp:Button>
<asp:ValidationSummary
id="ValidationSummary1"
runat="server"
ShowMessageBox="True"
ShowSummary="False">
</asp:ValidationSummary>
</form>
</body>
</html>