Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Wednesday, July 30, 2014

Button Control

Deceleration Of Button in asp.net 

Asp.net has button control and html also has a button control.for taking asp.net button control use 
<asp:Button id="button1" Text="ok " runat="server" />


.Net Provide web (server And User )controls which has facility to use controls by drag and drop on the page from toolbox.When you use this then the code is automatically generated.
asp.net programming
Asp.net programming Button control


Asp.net button control properties :


  • CausesValidation: Refers if a page is validated when a button is click.
  • CommandArgument: Refers  additional information about the command to perform.
  • CommandName: Specifies the command.
  • OnClientClick:  javascript function to be executed when a button is clicked.
  • PostBackUrl:. post to from the current page when a button is clicked,some time it use two referce page .
  • Runat: define control is a server control. Must Execute Server end.
  • Text : define the text on a button.
  • UseSubmitBehavior: define whether or not a button uses the browser's submit  or the ASP.NET                                                   postback 
  • ValidationGroup: define the group of controls a button causes validation, when it posts back to the server.
  • AccessKey : refer key by Access the button control, 
  • BackColor: define backColor of button,
  •  BorderColor: define border color of Asp.net Button ,
  •  BorderWidth : refer to width of border for this give value 1, 2, 3,....,
  •  Font: refer which types of font use in button text,
  •  ForeColor :refer color of font in asp.net button , 
  • TabIndex : Refer access the page by keyboard ,
  •  ToolTip: show information on button hour  , 

Create Button control with Text property :

Asp.net programming Button control with style

Asp.net button control example:

<html>
<body>
<form runat="server">
<asp:Button id="button1" Text="ok " runat="server" />
</form>
</body>
</html>


Asp.net button control event handlers:

code on Asp.net (.aspx page)
<html>
<body>
<form runat="server">
<asp:Button id="button1" Text="ok " runat="server" onClick="button1_Click" />
</form>
</body>
</html>
code on asp.net (.aspx.cs page)
 protected void button1_Click(object sender, EventArgs e)
{
//Write your logic here......................
}



Constructors of Button control:
Button has Button() constructors .It is use for creating new object.        Button b1=new Button();
Hierarchy of Button Class

Reference :

Old Asp.net Related Post Post :