ASP Web Server Controls: Please Use Speaker Notes For Additional Information!
ASP Web Server Controls: Please Use Speaker Notes For Additional Information!
My code.
Output
Results of viewing
source.
<html>
<head>
<title>Label Web Server Control</title>
</head>
<body style="font:14pt arial; background-color:beige; color:brown">
<h1> ASP.NET Label Web Server Control</h1>
<form name="myForm" method="post" action="label1.aspx" id="myForm">
<input type="hidden" name="__VIEWSTATE" value="dDw5MjMzODA0MjI7Oz7nX6Hll9is/xmoOmyVBB64bHP3ag==" />
<html>
<head><title>Testing the Label Web Server Control</title>
<script runat="server">
Sub Page_Load
lblHeader.Text="Testing the Label Web Server Control"
lblDate.Text="Today is: " & now()
End Sub
</script>
<html>
<body>
<h1 align=center>ASP.NET</h1>
<form runat="server">
<h2 align=center><asp:label id="lblHeader" runat="server" /></h2>
<h3 align=center><asp:label id="lblDate" runat="server" /></h3>
</form>
</body>
</html>
<html>
<head><title>Testing the Label Web Server Control</title>
<script runat="server">
Sub Page_Load
lblHeader.Text="Testing the Label Web Server Control"
lblDate.Text="Today is: " & now()
End Sub
</script>
<html> My code is shown here.
<body>
<h1 align=center>ASP.NET</h1>
<form runat="server"> The output is
<h2 align=center><asp:label id="lblHeader" runat="server" /></h2> shown here.
<h3 align=center><asp:label id="lblDate" runat="server" /></h3>
</form>
</body>
</html> When you click on view source,
you see the code below.
<html>
<head><title>Testing the Label Web Server Control</title>
<html>
<body>
<h1 align=center>ASP.NET</h1>
<form name="_ctl0" method="post" action="label2.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE" value="dDwxMmore data...Hz4GuNM6guGY=" />
<h2 align=center><span id="lblHeader">Testing the Label Web Server Control</span></h2>
<h3 align=center><span id="lblDate">Today is: 6/24/2003 4:56:55 PM</span></h3>
</form>
</body>
</html>
Label
LabelWeb
WebServer
ServerControl
Control
<html>
<head><title>Testing the Label Web Server Control</title>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
lblHeader.Text="Testing the Label Web Server Control"
lblDate.Text="Today is: " & now()
End Sub
</script>
<html>
<body>
<h1 align=center>ASP.NET</h1>
<form runat="server">
<h2 align=center><asp:label id="lblHeader" runat="server" /></h2>
<h3 align=center><asp:label id="lblDate" runat="server" /></h3>
</form>
</body>
</html>
Button
Button&&Textbox
TextboxWeb
WebServer
ServerControls
Controls
<html>
<head>
<title>Textbox Web Server Control</title>
<script runat="server">
Sub NameSub(sender As Object, e As EventArgs)
lblGreet.text = "Hi, " & txtFst.text & " " & txtLast.text
End Sub
</script>
</head>
<body style="font: 12pt arial">
<h1 align=center>ASP.NET</h1>
<h2 align=center>Textbox Web Server Control</h2>
<form ID="NameForm" runat="server">
First Name <asp:TextBox id=txtFst ForeColor="blue" runat="server" />
Last Name <asp:TextBox id=txtLast ForeColor="red" runat="server" />
<asp:Button Text="Submit" OnClick="NameSub" runat="server" />
<asp:Label id=lblGreet ForeColor="green" runat="server" />
</form>
</body>
</html>
<html>
<head>
<title>Textbox Web Server Control</title>
</head>
<body style="font: 12pt arial">
<h1 align=center>ASP.NET</h1>
<h2 align=center>Textbox Web Server Control</h2>
<form name="NameForm" method="post" action="textbox1.aspx" id="NameForm">
<input type="hidden" name="__VIEWSTATE" value="dDwxMzQ2M more code...Q0W2al2/nSpeg=" />
Clears the sentence which is made up of the phrase Your sentence in a paragraph
followed by the selected elements formed into the mySentence structure.
<body>
<form runat="server">
<asp:CheckBoxList id="phrases" AutoPostBack="True"
TextAlign="Right" OnSelectedIndexChanged="makeSentence"
runat="server">
<asp:ListItem>The dog</asp:ListItem> The event OnSelectedIndexChanged causes
<asp:ListItem>The cat</asp:ListItem> makeSentence to be executed.
<asp:ListItem>The bird</asp:ListItem>
<asp:ListItem>The fish</asp:ListItem>
<asp:ListItem>The horse</asp:ListItem>
<asp:ListItem>ran</asp:ListItem>
<asp:ListItem>flew</asp:ListItem> This code sets up the elements in the list.
<asp:ListItem>swam</asp:ListItem>
<asp:ListItem>jumped</asp:ListItem>
<asp:ListItem>trotted</asp:ListItem>
<asp:ListItem>over the fence</asp:ListItem>
<asp:ListItem>onto the railing</asp:ListItem>
<asp:ListItem>into the rock</asp:ListItem>
<asp:ListItem>down the hill</asp:ListItem>
<asp:ListItem>into the tree</asp:ListItem>
<asp:ListItem>into the cage</asp:ListItem>
<asp:ListItem>up the stream</asp:ListItem> The label holds the sentence that
</asp:CheckBoxList>
<asp:label id="mySentence" runat="server"/> was constructed.
<br /><br />
<asp:Button id="clearButton" Text="Clear"
runat="server" OnClick="clear"/>
</form> A clear button is set up. The on click event
</body> causes the clearButton sub to be executed.
</html>
<html>
<head><title>Make sentences using List Items</title>
</head>
<body>
<form name="_ctl0" method="post" action="check1.aspx" id="_ctl0">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDwt more code...jQT1CbMw==" />
<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform = document._ctl0;
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
<span id="mySentence"><p>Your sentence: </p> The horse jumped over the fence</span>
<br /><br />
<input type="submit" name="clearButton" value="Clear" id="clearButton" />
</form>
</body>
</html>
<body>
<form runat="server">
<asp:CheckBoxList id="phrases" AutoPostBack="True"
TextAlign="Right" OnSelectedIndexChanged="makeSentence"
RepeatColumns=3 RepeatDirection=Vertical runat="server">
<asp:ListItem>The dog</asp:ListItem>
<asp:ListItem>The cat</asp:ListItem>
<asp:ListItem>The bird</asp:ListItem> Changed code to get 3 vertical
<asp:ListItem>The fish</asp:ListItem>
<asp:ListItem>The horse</asp:ListItem> columns.
<asp:ListItem>The duck</asp:ListItem>
<asp:ListItem>The elephant</asp:ListItem>
<asp:ListItem>ran</asp:ListItem>
<asp:ListItem>flew</asp:ListItem>
<asp:ListItem>swam</asp:ListItem> Added elements to the
<asp:ListItem>jumped</asp:ListItem>
<asp:ListItem>trotted</asp:ListItem>
list of items.
<asp:ListItem>lumbered</asp:ListItem>
<asp:ListItem>walked</asp:ListItem>
<asp:ListItem>over the fence</asp:ListItem>
<asp:ListItem>onto the railing</asp:ListItem>
<asp:ListItem>into the rock</asp:ListItem>
<asp:ListItem>down the hill</asp:ListItem>
<asp:ListItem>into the tree</asp:ListItem>
<asp:ListItem>into the cage</asp:ListItem>
<asp:ListItem>up the stream</asp:ListItem>
</asp:CheckBoxList>
<asp:label id="mySentence" runat="server"/>
<br /><br />
<asp:Button id="clearButton" Text="Clear"
runat="server" OnClick="clear"/>
</form>
</body>
</html>
Table
TableWeb
WebServer
ServerControl
Control
<html>
<head><title>Make sentences using List Items</title>
</head>
<body>
<form runat="server">
<asp:Table runat="server" id="flyPrice" BorderWidth=3
CellPadding=5 CellSpacing=5
GridLines="both" HorizontalAlign="Left">
<asp:TableRow>
<asp:TableCell>Fare Table</asp:TableCell>
<asp:TableCell>From Boston</asp:TableCell>
<asp:TableCell>From NY</asp:TableCell>
<asp:TableCell>From DC</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>To London</asp:TableCell>
<asp:TableCell>199</asp:TableCell>
<asp:TableCell>189</asp:TableCell>
<asp:TableCell>195</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>To San Francisco</asp:TableCell>
<asp:TableCell>245</asp:TableCell>
<asp:TableCell>230</asp:TableCell>
<asp:TableCell>295</asp:TableCell>
</asp:TableRow>