Chapter 2.3-ImageButton And LinkButton in asp.net

Add to Favourites
Post to:
Join the .NET Community

Description
Chapter 2.3-ImageButton And LinkButton in asp.net

Comments
Presentation Transcript Presentation Transcript

Chapter 2.3 : Chapter 2.3 Asp.net Image & LinkButton Control

Slide 2 : Asp.Net Control : Image Button Introduction The control displays an image that responds to mouse clicks like a button. The Image Button control perform similiar to the button control. You use an image Button when you want your button to look different than the plain rectangular button. Any image can be a button! Properties of a Image Button

Slide 3 : Creating a Image Button To create a image button, you first add a image button before configuring it. You can add a image button visually or manually. Here is an example: <%@ Page Language="C#" %> html> Exercise Setting the Image button properties visually.

Slide 4 :

Slide 5 : ImageButton.Click Event Occurs when the ImageButton is clicked. How to: Determine Coordinates in an ImageButton Web Server Control The following example demonstrates how to specify and code a handler for the Click event to display the coordinates at which the user clicks the image. <%@ Page Language="C#" %> Exercise

ImageButton Sample

Click anywhere on the image.



Slide 6 : Code Behind File void ImageButton_Click(object sender, ImageClickEventArgs e) { Label1.Text = "You clicked the ImageButton control at the coordinates: (" + e.X.ToString() + ", " + e.Y.ToString() + ")"; }

Slide 7 : Asp.Net LinkButton The LinkButton control is used to create a hyperlink button. This control looks like a HyperLink control but has the same functionality as the Button control! Properties of LinkButton Use the LinkButton control to create a hyperlink-style button on a Web Forms page. Specify the text to display in the LinkButton control by either setting the Text property or placing the text between the opening and closing tags of the LinkButton control. The LinkButton control has the same appearance as a HyperLink control, but has the same functionality as a Button control. Use the HyperLink control if you want to link to another Web page when the control is clicked.

Slide 8 : How to use LinkButton Use the LinkButton control if you want to link to another Web page when the control is clicked. <%@ Page Language="C#" %> Exercise

Open New page
Code Behind File (newpage.aspx.cs) using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls;

Slide 9 : using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class how_to_use_link_button_c : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
Adesh Sharma
A Senior Software Engineer working in a IT company on DOTNET platform
User
1 Member Recommends
6 Followers

Your Facebook Friends on WizIQ

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect