In moving to ASP.NET from classic ASP and ColdFusion, one of the first things that I had to adjust to was developing using only one form within a web page. This isn’t a true limitation, to be accurate, WebForms supports only one server-side form per web page but technically, there can still be multiple HTML forms on the page, the additional forms simply are not able to participate in the ASP.NET WebForms Framework.
<form runat="server"> <!-- a lot of magic here --> </form>
The aim, I believe, is to provide state and events in the world of web application development that are similar to what we are accustomed to with WinForms application development. So with WebForms we are provided with the concepts of viewstate and postback events, which are raised by other server-side form elements such as buttons, written as:
<asp:Button ID="MyButton" OnClick="MyButton_Click" runat="server">
Can be better represented as:
<div id="MyDiv" data-url="/mydestination.aspx" data-value1='<%= MyDataValue1 %>' data-value2='<%= MyDataValue2 %>'> <!-- display markup here --> </div>
Of course JQuery provides some convenient methods for enumerating and working with the data values; and although this was merely a short and dirty “how-to”, data attributes can also be expressed in JSON notation, as a collection of properties and values, instead of a data attribute for each value that you would like to represent.
In any case…it’s a good time to be a developer. All of the once so complicated concepts that we had to work around are all trivial implementations of semantics now.