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:



Popular posts from this blog