Simple example of IF/THEN using C#

Contributed by
Rating: 4 stars4 stars4 stars4 stars4 stars / 18
August 04, 2002
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

Here is the code

<%@ Page Language="C#" %>
<script runat="server">

void button1_Click(Object sender, EventArgs e)
{
if (textbox1.Text == "ASPFree.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#.&nbsp;
</p>
<form runat="server">
<i>If you type in <b>ASPFree.com</b>, that is the condition</i>
<br />
Fill something in:<asp:textbox id="textbox1" runat="server" value="ASPFree.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>

blog comments powered by Disqus
ASP.NET CODE ARTICLES

- How to Use the ListBox Control in ASP.NET 2.0
- How to Load XML Documents in ASP.NET 2.0
- DataGrid Code
- ASP.NET Guestbook
- User Controls and Client Side Scripting
- ASP.NET Programming with Microsoft's AS...
- ASP.NET Basics (part 3): Hard Choices
- ASP.NET Basics (part 2): Not My Type
- ASP.NET Basics (part 1): Nothing But .Net
- Directory Tree Browser
- How to get the confirmation of Yes/No from a...
- Complete example using custom errors and wri...
- Paging Certain # records per page .NET style
- General Methods of formatting and Subtractin...
- .NET LinkButton web control

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials