|
Simple If/Then statement in C#
This is simple if/then statement to help get started learning C#.
Here is the code
|
<%@ Page Language="C#" %>
<script runat="server">
void button1_Click(Object sender, EventArgs e)
{
if (textbox1.Text == ".com")
{
Literal1.Text
= "Textbox Condition was <b>True</b>";
}
else
{
Literal1.Text
= "Textbox Condition was <b>False</b>";
}
}
</script>
<html>
<head>
</head>
<body>
<h2 align="center">Simple If/Then statement in C#
</h2>
<p align="left">
This is simple if/then statement to help
get started learning C#.
</p>
<form runat="server">
<i>If you type in <b>.com</b>,
that is the condition</i>
<br />
Fill something in:<asp:textbox id="textbox1"
runat="server" value=".com"></asp:textbox>
<br />
<br />
<asp:button id="button1" onclick="button1_Click"
runat="server" text="Click me"></asp:button>
<br />
<br />
<br />
<asp:Literal id="Literal1" runat="server"></asp:Literal>
</form>
</body>
</html>
|
|
|