ASP.NET - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

ASP.NET Button

ASP.NET Button

shape Description

The ASP.NET Button control is generally used in all type of forms. Button has, properties like Enabled, PostBackUrl, Text etc. Button has event called Click_Raised, Button_Click, Command_Raised etc.

shape Conceptual figure

Basic structure of the Button is below: [html]<asp:Button ID="spButton" runat="server" Text="Button" />[/html] The interaction diagram for the "Submit" button is below.

shape Types

There are different types of buttons, which are used in ASP.NET. Those are mentioned below with the proper syntax.
  • LinkButton, [html] <asp:LinkButton id="spLinkButton" Text="Click Here" Font-Names="Arial Black" Font-Size="14pt" OnClick="LinkButton_Click" runat="server"/> [/html]
  • ImageButton, [html] <asp:ImageButton id="spImageButton" runat="server" AlternateText="Image can’t be loaded" ImageAlign="center" ImageUrl="http://www.splessons.com/wp-content/uploads/2015/07/camera3.jpg" OnClick="ImageButton_Click"/> [/html]
  • Push Button [html] <asp:Button id="spButton" Text="Submit" runat="server" /> [/html]
In the below form, one can see two buttons used and they are "Submit" and "Reset". On clicking of "Submit" button, the form will be submitted and on clicking "Reset" button, all the entries in the form will be reset.