WebControl.AccessKey 속성

정의

웹 서버 컨트롤을 빠르게 탐색할 수 있는 선택키를 가져오거나 설정합니다.

public:
 virtual property System::String ^ AccessKey { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public virtual string AccessKey { get; set; }
public virtual string AccessKey { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.AccessKey : string with get, set
member this.AccessKey : string with get, set
Public Overridable Property AccessKey As String

속성 값

웹 서버 컨트롤에 대한 빠른 탐색을 위한 선택키입니다. 기본값은 Empty로, 이 속성이 설정되지 않았음을 나타냅니다.

특성

예외

지정한 선택키가 null, Empty 또는 단일 문자열이 아닌 경우

예제

다음 예제에서는 설정 하 고 사용 하는 방법을 보여 줍니다 합니다 AccessKey 의 속성을 TextBox 컨트롤입니다.

중요

이 예제에는 사용자 입력을 허용하는 텍스트 상자가 있으므로 보안상 위험할 수 있습니다. 기본적으로 ASP.NET 웹 페이지는 사용자 입력 내용에 스크립트 또는 HTML 요소가 포함되어 있지 않은지 확인합니다. 자세한 내용은 Script Exploits Overview를 참조하세요.

<%@ 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>AccessKey Property of a Web Control</title>
</head>
 <body>
 
   <h3>AccessKey Property of a Web Control</h3>
 
 <form id="form1" runat="server">
 
   <asp:TextBox id="TextBox1" 
     AccessKey="Y" 
     Text="Press Alt-Y to get focus here" 
     Columns="45"
     runat="server"/>
 
   <br />
 
   <asp:TextBox id="TextBox2" 
     AccessKey="Z" 
     Text="Press Alt-Z to get focus here" 
     Columns="45"
     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">
<html xmlns="http://www.w3.org/1999/xhtml" >
 <head>
    <title>AccessKey Property of a Web Control</title>
</head>
 <body>
 
   <h3>AccessKey Property of a Web Control</h3>
 
 <form id="form1" runat="server">
 
   <asp:TextBox id="TextBox1" 
     AccessKey="Y" 
     Text="Press Alt-Y to get focus here" 
     Columns="45"
     runat="server"/>
 
   <br />
 
   <asp:TextBox id="TextBox2" 
     AccessKey="Z" 
     Text="Press Alt-Z to get focus here" 
     Columns="45"
     runat="server"/>
 
 </form>
 
 </body>
 </html>

설명

사용 된 AccessKey 속성을 통해 웹 서버 컨트롤에 대 한 바로 가기 키를 지정 합니다. 이 옵션을 사용 하면 키보드에서 ALT 키와 지정된 된 문자에 대 한 키를 눌러 컨트롤을 신속 하 게 이동할 수 있습니다. 예를 들어, 컨트롤의 액세스 키를 문자열로 설정 "D" ALT + D를 눌러 컨트롤을 탐색할 수 있습니다.

만 단일 문자 문자열에 허용 되는 AccessKey 속성입니다. 이 아닌 값으로이 속성을 설정 하려고 하면 null, Empty, 또는 단일 문자열이 예외가 throw 됩니다.

참고

이 속성은 Internet Explorer 4.0 에서만에서 이상 지원 합니다.

적용 대상

추가 정보