ControlsDemo.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ControlsDemo.aspx.cs" Inherits="Demos_ControlsDemo" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="YourName" runat="server"></asp:TextBox> Your name<asp:Button ID="SubmitButton" runat="server" onclick="SubmitButton_Click" Text="Submit Information" /> <br /> <asp:Label ID="Label1" runat="server"></asp:Label> </div> </form> </body> </html>
ControlsDemo.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Demos_ControlsDemo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SubmitButton_Click(object sender, EventArgs e)
{
Label1.Text = "Your name is " + YourName.Text;
}
}
And it generates the following HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title> </title></head> <body> <form method="post" action="ControlsDemo.aspx" id="form1"> <div class="aspNetHidden"> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMjA3NjE4MDczNmRkRGmHS7RUhqAsayIODjq5pVJOcGbUHV0WvUwTwAHUntw=" /> </div> <div class="aspNetHidden"> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwL1/Mu5BALTydp0ArK44tQL6C3smRvQPjZBKPU4WeN35xjWrwcelGNXJR2senwT5+I=" /> </div> <div> <input name="YourName" type="text" id="YourName" /> Your name<input type="submit" name="SubmitButton" value="Submit Information" id="SubmitButton" /> <br /> <span id="Label1"></span> </div> </form> </body> </html>
In the book there is no mention of the div tags containing the class aspNetHidden. Is that code supposed to be displaying in the HTML code? I find it kind of strange.


Sign In
Create Account

Back to top









