asp:Button control
Button control is used to post the form or fire an event either client side or server side..
Button control is for the most part used to post the frame or fire an occasion either customer side or server side. When it is rendered on the page, it is by and large executed through <input type=submit> HTML tag. In any case, if UserSubmitBehavior property is set to false at that point control will render out as <input type=button>.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height and so forth are executed through style properites of <input> tag. You can set its Text property either by setting Text property in the .aspx page or from server side page. (different properties can likewise be set from the two pages)
A catch can be set as default catch (Default catch is a catch that is Clicked when the client presses Enter key while filling a shape.) by indicating DefaultButton property of the <form> tag or to the asp:Panel tag in which it is put. eg. In the event that we need to set a catch with id btnSubmit as default catch we can add following properties to the <form> component. <form id="Form1" DefaultButton="btnSubmit" runat="server">.
Following are some important properties that are very useful.
Button control is used to post the form or fire an event either client side or server side..
Button control is for the most part used to post the frame or fire an occasion either customer side or server side. When it is rendered on the page, it is by and large executed through <input type=submit> HTML tag. In any case, if UserSubmitBehavior property is set to false at that point control will render out as <input type=button>.
Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height and so forth are executed through style properites of <input> tag. You can set its Text property either by setting Text property in the .aspx page or from server side page. (different properties can likewise be set from the two pages)
A catch can be set as default catch (Default catch is a catch that is Clicked when the client presses Enter key while filling a shape.) by indicating DefaultButton property of the <form> tag or to the asp:Panel tag in which it is put. eg. In the event that we need to set a catch with id btnSubmit as default catch we can add following properties to the <form> component. <form id="Form1" DefaultButton="btnSubmit" runat="server">.
Following are some important properties that are very useful.
UserSubmitBehavior | true/false. If true, the button will be used as client browser submit mechanism else asp.net postback mechanism. |
CausesValidation | Value can be set as true/false. This indicates whether validation will be performed when a button is clicked. |
PostBackUrl | Indicates the URL on which the Form will be posted back. |
ValidationGroup | Gets or Sets the name of the validation group that the button belongs to. This is used to validate only a set of Form controls with a Button. |
OnClick | Attach a server side method that will fire when button will be clicked. |
OnClientClick | Attach a client side (javascript) event that will fire when button will be clicked. |
DEMO : Button | |
// With OnClick event
<asp:Button ID="btnServer" runat="Server" Text="Activate Server Side Event" OnClick="ActivateServerSideEvent" />
// with OnClientClick event and CommandName
<asp:Button ID="btnClient" runat="Server" Text="Activate Client Side Method" OnClientClick="GiveAlertToUser()" UseSubmitBehavior="False" CommandName="ClientSideButton" />
// with OnClick & ValidationGroup
<asp:Button ID="Button1" runat="Server" OnClick="FireServerSideEvent" Text="Fire Server Side Event" ValidationGroup="demo" />
0 comments:
Post a Comment