HtmlInputImage.ServerClick 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
사용자가 HtmlInputImage 컨트롤을 클릭할 때 서버에서 발생합니다.
public:
event System::Web::UI::ImageClickEventHandler ^ ServerClick;
public event System.Web.UI.ImageClickEventHandler ServerClick;
member this.ServerClick : System.Web.UI.ImageClickEventHandler
Public Custom Event ServerClick As ImageClickEventHandler
이벤트 유형
예제
다음 코드 예제를 지정 하 고 사용자가 컨트롤을 클릭 하는 좌표를 결정 하는 이벤트에 대 한 ServerClick 처리기를 코딩 하는 방법을 보여 줍니다 HtmlInputImage .
<%@ 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">
<script runat="server">
protected void ImageBtn_Click(object sender, ImageClickEventArgs e)
{
// Write the click coordinates to the Span1 element.
Span1.InnerText = "You clicked at (" + e.X.ToString() +
", " + e.Y.ToString() + ").";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Click the Image </title>
</head>
<body>
<form id="form1" runat="server">
<h3>Click the Image </h3>
<input type="image"
alt="Image Alternate Text"
src="Image1.jpg"
onserverclick="ImageBtn_Click"
runat="server" id="Image1"/>
<br />
<br />
<span id="Span1"
runat="server"/>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub ImageBtn_Click(ByVal Sender As Object, ByVal E As ImageClickEventArgs)
' Write the click coordinates to the Span1 element.
Span1.InnerText = "You clicked at (" & E.X.ToString() & _
", " & E.Y.ToString() & ")."
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Click the Image </title>
</head>
<body>
<form id="form1" runat="server">
<h3>Click the Image </h3>
<input type="image"
alt="Image Alternate Text"
src="Image1.jpg"
onserverclick="ImageBtn_Click"
runat="server"/>
<br />
<br />
<span id="Span1"
runat="server"/>
</form>
</body>
</html>
<%@ 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">
<script runat="server">
void ImageBtn_Click(Object sender, ImageClickEventArgs e)
{
// Display the coordinates of the position where the image
// was clicked.
Span1.InnerText = "You clicked at (" + e.X.ToString() +
", " + e.Y.ToString() + ").";
}
void Page_Load(Object sender, EventArgs e)
{
// Create an EventHandler delegate for the method you want to
// handle the event, and then add it to the list of methods called
// when the event is raised.
Image1.ServerClick += new ImageClickEventHandler(this.ImageBtn_Click);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>HtmlInputImage ServerClick Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3>HtmlInputImage ServerClick Example </h3>
<input type="image"
id="Image1"
src="Image.jpg"
alt="Image"
runat="server"/>
<br />
<span id="Span1"
runat="server"/>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub ImageBtn_Click(ByVal sender As Object, ByVal e As ImageClickEventArgs)
' Display the coordinates of the position where the image
' was clicked.
Span1.InnerText = "You clicked at (" & e.X.ToString() & _
", " & e.Y.ToString() & ")."
End Sub
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Create an EventHandler delegate for the method you want to
' handle the event, and then add it to the list of methods called
' when the event is raised.
AddHandler Image1.ServerClick, AddressOf ImageBtn_Click
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>HtmlInputImage ServerClick Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3>HtmlInputImage ServerClick Example </h3>
<input type="image"
id="Image1"
src="Image.jpg"
alt="Image"
runat="server"/>
<br />
<span id="Span1"
runat="server"/>
</form>
</body>
</html>
설명
ServerClick 사용자가 컨트롤을 클릭하면 이벤트가 발생합니다HtmlInputImage.
이벤트를 처리 하는 방법에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.
적용 대상
추가 정보
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET