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

ImageButton

 ImageButton control in asp.net 

Asp.net has Image button control and html also has a button control.for taking asp.net Image button control use .Image Control is a type of asp.net control.

<asp:ImageButton id="imagebutton1" 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 ImageButton control 

Control with fallowing Properties

<asp:ImageButton id="imagebutton1" runat="server"
           AlternateText="ImageButton 1"
           ImageAlign="left"
           ImageUrl="~/Images/Flower1.jpg"
           OnClick="ImageButton_Click" Height="100px" Width="100px" 
          BorderStyle="Groove"/>

Asp.net button control properties :


  • AccessKey : Get or set the access key that allows you to quickly navigate .
  • Adapter : it is Protected property Gets the browser-specific adapter for the control.
  • AlternateText :it is a Public propertyGets or sets the alternate text displayed in the Image control when the image is unavailable. Browsers that support the ToolTips feature display this text as a ToolTip. (Inherited from Image.)
  • AppRelativeTemplateSourceDirectory: it is Public property of Imagebutton Gets or sets the application
  • Attributes : take the collection of arbitrary attributes that.Inherited from WebControl.
  • Public property Page : Gets a reference to the Page instance that contains the server control. (Inherited from Control.)

Events of Image Button Asp.net


  • Click Event : Generate  when the ImageButton is clicked.
  • Command: refer when the ImageButton is clicked.
  • DataBinding : Discripbe when the server control binds to a data source.
  • Disposed :  Refer when a server control is released from memory.
  • Load :  Occurs when the server control is loaded on Page object. (Inherited from Control.)
  • PreRender :  after the Control object is loaded but prior to rendering. 


Asp.net button control example:

<html>
<body>
<form runat="server">
          <asp:ImageButton id="imagebutton1" runat="server/>
</form>
</body>
</html>

Constructors of ImageButton:

Button has ImageButtonconstructors .It is use for creating new object. 
      ImageButton Imgb1=new ImageButton();


Inheritance Hierarchy of ImageButton

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.Image
        System.Web.UI.WebControls.ImageButton

Asp.net Imagebutton control event handlers Example



Other Post: