Button.IPostBackEventHandler.RaisePostBackEvent(String) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
서버에 포스트백될 때 Button 컨트롤에 대한 이벤트를 발생시킵니다.
virtual void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(System::String ^ eventArgument) = System::Web::UI::IPostBackEventHandler::RaisePostBackEvent;
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument);
abstract member System.Web.UI.IPostBackEventHandler.RaisePostBackEvent : string -> unit
override this.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent : string -> unit
Sub RaisePostBackEvent (eventArgument As String) Implements IPostBackEventHandler.RaisePostBackEvent
매개 변수
- eventArgument
- String
이벤트의 인수입니다.
구현
예제
다음 코드 예제를 재정의 IPostBackEventHandler.RaisePostBackEvent 하는 방법을 보여 줍니다.는 항상 사용자 지정 Button 컨트롤에서 이벤트를 발생 OnClick 되도록 메서드.
namespace Samples.AspNet.CS.Controls
{
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
public class CustomButtonRaisePostBackEvent : System.Web.UI.WebControls.Button, System.Web.UI.IPostBackEventHandler
{
private string message = System.String.Empty;
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
// Render a HTML submit button.
writer.Write("<INPUT TYPE='submit' name='" + this.UniqueID + "' value='Click Me' />");
writer.Write("<BR>" + message);
}
// Re-implement the IPostBackEventHandler's RaisePostBackEvent method.
// Note: C# allows this, where VB.NET does not.
public void RaisePostBackEvent(System.String eventArgument)
{
// Raise the Click event of the custom Button web control.
OnClick(new System.EventArgs());
// Don't call the Page.Validate or OnCommand events,
// which the base IPostBackEventHandler's RaisePostBackEvent method does.
}
protected override void OnClick(System.EventArgs e)
{
message = "RaisePostBackEvent method successful!";
}
}
}
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Public Class CustomButtonRaisePostBackEvent
Inherits System.Web.UI.WebControls.Button
Private message As String = System.String.Empty
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
' Render a HTML submit button.
writer.Write("<INPUT TYPE='submit' name='" + Me.UniqueID + "' value='Click Me' />")
writer.Write("<BR>" + message)
End Sub
' Note: VB.NET does not allow one to re-implement a base class interface, whereas C# does.
' Hence, just use the base class's PostBackEventHandler's RaisePostBackEvent method,
' which calls the OnClick method.
Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
message = "RaisePostBackEvent method successful!"
End Sub
End Class
설명
이 이벤트는 내부적으로 Button 사용 됩니다는 컨트롤을 클릭할 때 이벤트를 발생 Click 시키고 정의 Command 된 경우 이벤트입니다.
적용 대상
추가 정보
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET