forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.razor.txt
More file actions
46 lines (38 loc) · 1.13 KB
/
sample.razor.txt
File metadata and controls
46 lines (38 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
@{
var total = 0;
var totalMessage = "";
@* a multiline
razor comment embedded in csharp *@
if (IsPost) {
// Retrieve the numbers that the user entered.
var num1 = Request["text1"];
var num2 = Request["text2"];
// Convert the entered strings into integers numbers and add.
total = num1.AsInt() + num2.AsInt();
<italic><bold>totalMessage = "Total = " + total;</bold></italic>
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Add Numbers</title>
<meta charset="utf-8" />
</head>
<body>
<p>Enter two whole numbers and then click <strong>Add</strong>.</p>
<form action="" method="post">
<p><label for="text1">First Number:</label>
<input type="text" name="text1" />
</p>
<p><label for="text2">Second Number:</label>
<input type="text" name="text2" />
</p>
<p><input type="submit" value="Add" /></p>
</form>
@* now we call the totalMessage method
(a multi line razor comment outside code) *@
<p>@totalMessage</p>
<p>@(totalMessage+"!")</p>
An email address (with escaped at character): name@@domain.com
</body>
</html>