Page.GetPostBackEventReference 메서드

정의

서버에 다시 게시 작업을 발생시키는 클라이언트 이벤트에 사용할 수 있는 문자열을 반환합니다. 이 메서드는 사용되지 않습니다. 대신 GetPostBackEventReference 클래스의 ClientScriptManager 메서드를 사용합니다.

오버로드

GetPostBackEventReference(Control)
사용되지 않습니다.

서버에 다시 게시 작업을 발생시키는 클라이언트 이벤트에 사용할 수 있는 문자열을 반환합니다. 참조 문자열은 지정된 Control 개체에 의해 정의됩니다.

GetPostBackEventReference(Control, String)
사용되지 않습니다.

서버에 다시 게시 작업을 발생시키는 클라이언트 이벤트에 사용할 수 있는 문자열을 반환합니다. 참조 문자열은 다시 게시 작업과 추가 이벤트 정보의 문자열 인수를 처리하는 지정된 컨트롤에 의해 정의됩니다.

GetPostBackEventReference(Control)

주의

The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202

서버에 다시 게시 작업을 발생시키는 클라이언트 이벤트에 사용할 수 있는 문자열을 반환합니다. 참조 문자열은 지정된 Control 개체에 의해 정의됩니다.

public:
 System::String ^ GetPostBackEventReference(System::Web::UI::Control ^ control);
public string GetPostBackEventReference (System.Web.UI.Control control);
[System.Obsolete("The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202")]
public string GetPostBackEventReference (System.Web.UI.Control control);
member this.GetPostBackEventReference : System.Web.UI.Control -> string
[<System.Obsolete("The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202")>]
member this.GetPostBackEventReference : System.Web.UI.Control -> string
Public Function GetPostBackEventReference (control As Control) As String

매개 변수

control
Control

서버에서 다시 게시 작업을 처리하는 서버 컨트롤입니다.

반환

String

클라이언트의 스크립트로 처리될 때 다시 게시 작업을 시작하는 문자열입니다.

특성

예제

   public class MyControl1 : Control, IPostBackEventHandler
   {
      // Create an integer property that is displayed when
      // the page that contains this control is requested
      // and save it to the control's ViewState property.
      public int Number
      {
        get
        {
          if ( ViewState["Number"] !=null )
          return (int) ViewState["Number"];
          return 50;
        }

        set
        {
          ViewState["Number"] = value;
        }        
      }

      // Implement the RaisePostBackEvent method from the
      // IPostBackEventHandler interface. If 'inc' is passed
      // to this method, it increases the Number property by one.
      public void RaisePostBackEvent(string eventArgument)
      {
        Number = Number + 1;
      }

[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
      protected override void Render(HtmlTextWriter writer)
      {
        // Converts the Number property to a string and
    // writes it to the containing page.
        writer.Write("The Number is " + Number.ToString() + " (" );

    // Uses the GetPostBackEventReference method to pass
    // 'inc' to the RaisePostBackEvent method when the link
    // this code creates is clicked.
        writer.Write("<a href=\"javascript:" + Page.GetPostBackEventReference(this) + "\">Increase Number</a>");
      }
   }
Public Class MyControl1
   Inherits Control
   Implements IPostBackEventHandler 
   
   ' Create an integer property that is displayed when
   ' the page that contains this control is requested
   ' and save it to the control's ViewState property.
   Public Property Number() As Integer
      Get
         If Not (ViewState("Number") Is Nothing) Then
            Return CInt(ViewState("Number"))
         End If
         Return 50
      End Get
      
      Set
         ViewState("Number") = value
      End Set
   End Property
   

   ' Implement the RaisePostBackEvent method from the
   ' IPostBackEventHandler interface. If inc is passed
   ' to this method, it increases the Number property by one.      
   Public Sub RaisePostBackEvent(eventArgument As String) Implements IPostBackEventHandler.RaisePostBackEvent

      Number = Number + 1
   End Sub
   
   <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
   Protected Overrides Sub Render(writer As HtmlTextWriter)
      ' Converts the Number property to a string and
  ' writes it to the containing page.
      writer.Write(("The Number is " + Number.ToString() + " ("))

  ' Uses the GetPostBackEventReference method to pass
  ' inc to the RaisePostBackEvent method when the link
  ' this code creates is clicked.         
      writer.Write(("<a href=""javascript:" + Page.GetPostBackEventReference(Me) + """>Increase Number</a>"))
   End Sub
End Class

설명

이 메서드는 사용되지 않습니다. 대신 GetPostBackEventReference 클래스의 ClientScriptManager 메서드를 사용합니다.

추가 정보

적용 대상

GetPostBackEventReference(Control, String)

주의

The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202

서버에 다시 게시 작업을 발생시키는 클라이언트 이벤트에 사용할 수 있는 문자열을 반환합니다. 참조 문자열은 다시 게시 작업과 추가 이벤트 정보의 문자열 인수를 처리하는 지정된 컨트롤에 의해 정의됩니다.

public:
 System::String ^ GetPostBackEventReference(System::Web::UI::Control ^ control, System::String ^ argument);
public string GetPostBackEventReference (System.Web.UI.Control control, string argument);
[System.Obsolete("The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202")]
public string GetPostBackEventReference (System.Web.UI.Control control, string argument);
member this.GetPostBackEventReference : System.Web.UI.Control * string -> string
[<System.Obsolete("The recommended alternative is ClientScript.GetPostBackEventReference. http://go.microsoft.com/fwlink/?linkid=14202")>]
member this.GetPostBackEventReference : System.Web.UI.Control * string -> string
Public Function GetPostBackEventReference (control As Control, argument As String) As String

매개 변수

control
Control

다시 게시 작업을 처리하는 서버 컨트롤입니다.

argument
String

서버 컨트롤에 전달된 매개 변수입니다.

반환

String

클라이언트의 스크립트로 처리될 때 다시 게시 작업을 시작하는 문자열입니다.

특성

예제

   public class MyControl : Control, IPostBackEventHandler
   {
      
      // Create an integer property that is displayed when
      // the page that contains this control is requested
      // and save it to the control's ViewState property.
      public int Number
      {
        get
        {
          if ( ViewState["Number"] !=null )
             return (int) ViewState["Number"];
          return 50;
        }

        set
        {
          ViewState["Number"] = value;
        }        
      }

      // Implement the RaisePostBackEvent method from the
      // IPostBackEventHandler interface. If 'inc' is passed
      // to this method, it increases the Number property by one.
      // If 'dec' is passed to this method, it decreases the
      // Number property by one.
      public void RaisePostBackEvent(string eventArgument)
      {
        if ( eventArgument == "inc" )
        Number = Number + 1;

        if ( eventArgument == "dec" )
        Number = Number - 1;
      }

[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
      protected override void Render(HtmlTextWriter writer)
      {
        // Converts the Number property to a string and
    // writes it to the containing page.
        writer.Write("The Number is " + Number.ToString() + " (" );

    // Uses the GetPostBackEventReference method to pass
    // 'inc' to the RaisePostBackEvent method when the link
    // this code creates is clicked.
        writer.Write("<a href=\"javascript:" + Page.GetPostBackEventReference(this,"inc") + "\">Increase Number</a>"); 

        writer.Write(" or ");

    // Uses the GetPostBackEventReference method to pass
    // 'dec' to the RaisePostBackEvent method when the link
    // this code creates is clicked.
        writer.Write("<a href=\"javascript:" + Page.GetPostBackEventReference(this,"dec") + "\">Decrease Number</a>");
      }
   }
Public Class MyControl
   Inherits Control
   Implements IPostBackEventHandler

   ' Create an integer property that is displayed when
   ' the page that contains this control is requested
   ' and save it to the control's ViewState property.      
   Public Property Number() As Integer
      Get
         If Not (ViewState("Number") Is Nothing) Then
            Return CInt(ViewState("Number"))
         End If
         Return 50
      End Get
      
      Set
         ViewState("Number") = value
      End Set
   End Property      
   
   ' Implement the RaisePostBackEvent method from the
   ' IPostBackEventHandler interface. If inc is passed
   ' to this method, it increases the Number property by one.
   ' If dec is passed to this method, it decreases the
   ' Number property by one.
   Sub RaisePostBackEvent(eventArgument As String) Implements IPostBackEventHandler.RaisePostBackEvent

      If eventArgument = "inc" Then
         Number = Number + 1
      End If 
      If eventArgument = "dec" Then
         Number = Number - 1
      End If
   End Sub
   
   <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _ 
   Protected Overrides Sub Render(writer As HtmlTextWriter)
      ' Converts the Number property to a string and
  ' writes it to the containing page.
      writer.Write(("The Number is " + Number.ToString() + " ("))
      
  ' Uses the GetPostBackEventReference method to pass
  ' inc to the RaisePostBackEvent method when the link
  ' this code creates is clicked.
      writer.Write(("<a href=""javascript:" + Page.GetPostBackEventReference(Me, "inc") + """>Increase Number</a>"))
      
      writer.Write(" or ")

  ' Uses the GetPostBackEventReference method to pass
  ' dec to the RaisePostBackEvent method when the link
  ' this code creates is clicked.         
      writer.Write(("<a href=""javascript:" + Page.GetPostBackEventReference(Me, "dec") + """>Decrease Number</a>"))
   End Sub
End Class

설명

이 메서드는 사용되지 않습니다. 대신 GetPostBackEventReference 클래스의 ClientScriptManager 메서드를 사용합니다.

추가 정보

적용 대상