ASP.NET Web Forms - HTML Forms

All server controls must show up inside a <form> tag, and the <form> label must contain the runat="server" attribute.

ASP.NET Web Forms

All server controls must show up inside a <form> tag, and the <form> label must contain the runat="server" characteristic. The runat="server" trait demonstrates that the structure ought to be handled on the server. It additionally shows that the encased controls can be gotten to by server scripts:

<form runat="server">

...HTML + server controls


Note: The structure is constantly submitted to the page itself. In the event that you determine an activity trait, it is disregarded. On the off chance that you overlook the strategy property, it will be set to method="post" as a matter of course. Additionally, on the off chance that you don't determine the name and id traits, they are naturally allocated by ASP.NET.

Note: An .aspx page can just contain ONE <form runat="server"> control!

If you select view source in an .aspx page containing a structure with no name, strategy, activity, or id quality determined, you will see that ASP.NET has included these ascribes to the structure. It looks something like this:

<form name="_ctl0" method="post" action="page.aspx" id="_ctl0">

...some code


Submitting a Form

A structure is regularly presented by tapping on a catch. The Button server control in ASP.NET has the accompanying format:

<asp:Button id="id" text="label" OnClick="sub" runat="server"/>

The id characteristic characterizes a remarkable name for the catch and the content trait relegates a name to the catch. The onClick occasion handler determines a named subroutine to execute.

In the accompanying precedent we proclaim a Button control in an .aspx document. A catch click runs a subroutine which changes the content on the button:


Welookups is optimized for learning.© kumar aditya singh .
All Right Reserved and you agree to have read and accepted our term and condition.
All Rights Reserved.