Page.GetPostBackEventReference Page.GetPostBackEventReference Page.GetPostBackEventReference Method

定義

クライアント イベントで使用できる、サーバーにポストバックするための文字列を返します。Returns a string that can be used in a client event to cause postback to the server. このメソッドの使用は非推奨とされました。This method has been deprecated. 代わりに GetPostBackEventReference クラスの ClientScriptManager メソッドを使用してください。Use the GetPostBackEventReference method in the ClientScriptManager class instead.

オーバーロード

GetPostBackEventReference(Control) GetPostBackEventReference(Control) GetPostBackEventReference(Control)

クライアント イベントで使用できる、サーバーにポストバックするための文字列を返します。Returns a string that can be used in a client event to cause postback to the server. この参照文字列は、指定した Control オブジェクトによって定義されます。The reference string is defined by the specified Control object.

GetPostBackEventReference(Control, String) GetPostBackEventReference(Control, String) GetPostBackEventReference(Control, String)

クライアント イベントで使用できる、サーバーにポストバックするための文字列を返します。Returns a string that can be used in a client event to cause postback to the server. この参照文字列は、ポストバックと追加のイベント情報の文字列引数を処理する、指定したコントロールによって定義されます。The reference string is defined by the specified control that handles the postback and a string argument of additional event information.

GetPostBackEventReference(Control) GetPostBackEventReference(Control) GetPostBackEventReference(Control)

警告

この API は現在使われていません。

クライアント イベントで使用できる、サーバーにポストバックするための文字列を返します。Returns a string that can be used in a client event to cause postback to the server. この参照文字列は、指定した Control オブジェクトによって定義されます。The reference string is defined by the specified Control object.

public:
 System::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

パラメーター

control
Control Control Control

サーバー上でポストバックを処理するサーバー コントロール。The server control to process the postback on the server.

戻り値

クライアントでスクリプトとして扱われた場合に、ポストバックを初期化する文字列。A string that, when treated as script on the client, initiates the postback.

   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 'RaisePostBackEvent
    
    <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 'Render
 End Class 'MyControl1

注釈

このメソッドの使用は非推奨とされました。This method has been deprecated. 代わりに GetPostBackEventReference クラスの ClientScriptManager メソッドを使用してください。Use the GetPostBackEventReference method in the ClientScriptManager class instead.

こちらもご覧ください

GetPostBackEventReference(Control, String) GetPostBackEventReference(Control, String) GetPostBackEventReference(Control, String)

警告

この API は現在使われていません。

クライアント イベントで使用できる、サーバーにポストバックするための文字列を返します。Returns a string that can be used in a client event to cause postback to the server. この参照文字列は、ポストバックと追加のイベント情報の文字列引数を処理する、指定したコントロールによって定義されます。The reference string is defined by the specified control that handles the postback and a string argument of additional event information.

public:
 System::String ^ GetPostBackEventReference(System::Web::UI::Control ^ control, System::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

パラメーター

control
Control Control Control

ポストバックを処理するサーバー コントロール。The server control to process the postback.

argument
String String String

サーバー コントロールに渡されたパラメーター。The parameter passed to the server control.

戻り値

クライアントでスクリプトとして扱われた場合に、ポストバックを初期化する文字列。A string that, when treated as script on the client, initiates the postback.

   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 'RaisePostBackEvent
    
    <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 'Render
 End Class 'MyControl

注釈

このメソッドの使用は非推奨とされました。This method has been deprecated. 代わりに GetPostBackEventReference クラスの ClientScriptManager メソッドを使用してください。Use the GetPostBackEventReference method in the ClientScriptManager class instead.

こちらもご覧ください

適用対象