ClientScriptManager.RegisterExpandoAttribute 메서드

정의

이름/값 쌍을 지정한 컨트롤의 사용자 지정(expando) 특성으로 등록합니다.

오버로드

RegisterExpandoAttribute(String, String, String)

컨트롤 ID, 특성 이름 및 특성 값이 제공되면 이름/값 쌍을 지정한 컨트롤의 사용자 지정(expando) 특성으로 등록합니다.

RegisterExpandoAttribute(String, String, String, Boolean)

컨트롤 ID, 특성 이름, 특성 값 및 특성 값을 인코딩할지 여부를 나타내는 부울 값이 제공되면 이름/값 쌍을 지정한 컨트롤의 사용자 지정(expando) 특성으로 등록합니다.

RegisterExpandoAttribute(String, String, String)

컨트롤 ID, 특성 이름 및 특성 값이 제공되면 이름/값 쌍을 지정한 컨트롤의 사용자 지정(expando) 특성으로 등록합니다.

public:
 void RegisterExpandoAttribute(System::String ^ controlId, System::String ^ attributeName, System::String ^ attributeValue);
public void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue);
member this.RegisterExpandoAttribute : string * string * string -> unit
Public Sub RegisterExpandoAttribute (controlId As String, attributeName As String, attributeValue As String)

매개 변수

controlId
String

사용자 지정 특성이 포함된 페이지에 있는 Control입니다.

attributeName
String

등록할 사용자 지정 특성 이름입니다.

attributeValue
String

사용자 지정 특성 값입니다.

설명

합니다 RegisterExpandoAttribute 메서드는 이름/값 쌍을 지정 된 사용자 지정 (expando) 특성으로 등록 Control합니다. Expando 특성은 렌더링 된 컨트롤의 태그에 XHTML 호환성을 유지 하기 위해 JavaScript에서 동적으로 설정 됩니다. 사용자 지정 (expando) 특성의 값의 따옴표와 백슬래시는 이스케이프 됩니다. 따옴표와 백슬래시를 이스케이프 하려면 호출을 RegisterExpandoAttribute 메서드를 오버 로드 하 고 설정 합니다 encode 매개 변수를 false입니다.

Expando 특성 없거나 expando 특성을 추가 하려면 컨트롤이 없는 경우 클라이언트 스크립트는 여전히 내보내지지만 컨트롤 영향을 주지 않습니다.

추가 정보

적용 대상

RegisterExpandoAttribute(String, String, String, Boolean)

컨트롤 ID, 특성 이름, 특성 값 및 특성 값을 인코딩할지 여부를 나타내는 부울 값이 제공되면 이름/값 쌍을 지정한 컨트롤의 사용자 지정(expando) 특성으로 등록합니다.

public:
 void RegisterExpandoAttribute(System::String ^ controlId, System::String ^ attributeName, System::String ^ attributeValue, bool encode);
public void RegisterExpandoAttribute (string controlId, string attributeName, string attributeValue, bool encode);
member this.RegisterExpandoAttribute : string * string * string * bool -> unit
Public Sub RegisterExpandoAttribute (controlId As String, attributeName As String, attributeValue As String, encode As Boolean)

매개 변수

controlId
String

사용자 지정 특성이 포함된 페이지에 있는 Control입니다.

attributeName
String

등록할 사용자 지정 특성 이름입니다.

attributeValue
String

사용자 지정 특성 값입니다.

encode
Boolean

등록할 사용자 지정 특성을 인코딩할지 여부를 나타내는 부울 값입니다.

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 RegisterExpandoAttribute 메서드는 ClientScriptManager 클래스입니다. 렌더링 된 페이지 집합에서 클라이언트 스크립트를 title 특성을 <span> 요소입니다.

<%@ Page Language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
 
  public void Page_Load(Object sender, EventArgs e)
  {        
    // Get a ClientScriptManager reference from the Page class.
    ClientScriptManager cs = Page.ClientScript;
    
    // Register an expando attribute.
    cs.RegisterExpandoAttribute("Message", "title", "New title from client script.", true);
    
  }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ClientScriptManager Example</title>
  </head>
  <body>
     <form    id="Form1"
            runat="server">
     <span  id="Message" 
            title="Title to be replaced.">
            Place your mouse over this text to see the title.
     </span>           
     </form>
  </body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        
    ' Get a ClientScriptManager reference from the Page class.
    Dim cs As ClientScriptManager = Page.ClientScript
    
    ' Register an expando attribute.
    cs.RegisterExpandoAttribute("Message", "title", "New title from client script.", True)    
    
  End Sub
  
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ClientScriptManager Example</title>
  </head>
  <body>
     <form    id="Form1"
            runat="server">
     <span  id="Message" 
            title="Title to be replaced.">
            Place your mouse over this text to see the title.
     </span>
     </form>
  </body>
</html>

설명

합니다 RegisterExpandoAttribute 메서드는 이름/값 쌍을 지정 된 사용자 지정 (expando) 특성으로 등록 Control합니다. Expando 특성은 렌더링 된 컨트롤의 태그에 XHTML 호환성을 유지 하기 위해 JavaScript에서 동적으로 설정 됩니다. 설정 된 encode 매개 변수를 true 따옴표와 expando 특성의 값에서 백슬래시를 이스케이프 해야 할 경우.

Expando 특성 없거나 expando 특성을 추가 하려면 컨트롤이 없는 경우 클라이언트 스크립트는 여전히 내보내지지만 컨트롤 영향을 주지 않습니다.

추가 정보

적용 대상