Asp.net ImageButton control Example
Declare Asp.net Image Button control:
Declare ImageButton by fallowing code with property,As like Alternative text,ImageUrl,Height,Width.Image Button is predefined Asp.net web control Use in web development.
Asp.net ImageButton:
<asp:ImageButton id="imagebutton1" runat="server"
AlternateText="ImageButton 1"
ImageAlign="left"
ImageUrl="~/Images/Flower1.jpg"
OnClick="ImageButton_Click" Height="148px" Width="274px"/>
Access Asp.net ImageButton control useing javascript :
For Access ImageButton by javascript we use fallowing code<script language="C#" runat="server">
void ImageButton_Click(object sender, ImageClickEventArgs e)
{
Label1.Text = "You clicked ImageButton control at the coordinates: (" +
e.X.ToString() + ", " + e.Y.ToString() + ")";
}
</script>
By the JS code we get clicked position in Image.and print this on the Label Text.
Code of Asp.net Image Control:
<%@ Page Language="C#" AutoEventWireup="True" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>ImageButton Sample</title>
<script language="C#" runat="server">
void ImageButton_Click(object sender, ImageClickEventArgs e)
{
Label1.Text = "You clicked ImageButton control at the coordinates: (" +
e.X.ToString() + ", " + e.Y.ToString() + ")";
}
</script>
</head>
<body style="height: 261px">
<form id="form1" runat="server">
<h3>ImageButton Example:</h3>
Click Anywhere on the image.<br /><br />
<asp:ImageButton id="imagebutton1" runat="server"
AlternateText="ImageButton 1"
ImageAlign="left"
ImageUrl="~/Images/Flower1.jpg"
OnClick="ImageButton_Click" Height="148px" Width="274px"/>
<br />
<br />
<br />
<asp:label id="Label1" runat="server"/>
<br />
</form>
</body>
</html>
Asp.net Programming ImageButton |
- Asp.net-user-control-basics
- Introduction-of-asp.net-server-control.
- how-to-check-image-size-before.
- how-to-edit-list-view-template
- how-to-use-asp-list view-control-in.
- how-to-make-effective-frq-page-in-web
- how-to-use-repeater-control-in-asp.net.
- how-to-add-reference-of-dll-file-in.Asp.net
- how-to-use-how-to-use-captcha-in-asp net
- how-to-use-how-to-use-captcha-in-asp.net.html
- How-to-use-regular-expression-in-asp.net.html
- Using jQuery change Background color of DIV
- JQuery Change Div Background Color Randomly
- JQuery Change Div Background Color Randomly
- C# Variables,How to declare in C#:
- C# language Program Structure
- What keyword,How many keywords in C#