Notice that it is using Response.Write calls, which generates HTML.
Well no, more accurately it simply sends TEXT to the browser (note: it may
be any value from any data-type, but it gets sent to the client as text).
The text could be anything at all (HTML, JavaScript, VBScript, XML, etc.).
The "Write" method of the "Response" object doesn't care what text you write
and it doesn't "generate" anything. It just sends what you tell it to.
The tags <%= and %> are actually just a shortcut for Response.Write the
code inside.
More accurately, just the "=" used as a prefix for some expression that
results in a value that can be sent to the browser is a shortcut for
Response.Write. And, you could only use that shortcut when the script block
was only going to contain that one command (ie. <% ="Hello World" %>).
Viewstate is used by the server, and is not available for use on the
client. Modifying it's value will result in errors on the server. The
values in Viewstate are Base64 encoded, which means although it
"could" be read, it's not very easy - to put it mildly.
It is very easy to add and read items to/from ViewState in the CodeBehind
using ViewState.Add(key, value) and ViewState.Item(key). The stored and
then read value can then be use in any way that you want to, including
sending down to the client.
Look at <input> type=hidden> tags. If you add the runat="server" property, you get a
.NET object to code against, but you will have to use it's Attributes
collection rather than just setting it's Value property.
Um no. If you have marked the hidden form field as runat=server, you can
code against its .value property directly from the codebehind.
You've given several mistaken or misleading pieces of advice and/or facts
here. I suggest you read up on this or try it out before commenting.