Page.IsPostBack 속성

정의

페이지가 처음 렌더링 되 고 또는 포스트백에 대 한 응답으로 로드 되 고 있는지를 나타내는 값을 가져옵니다.Gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback.

public:
 property bool IsPostBack { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool IsPostBack { get; }
member this.IsPostBack : bool
Public ReadOnly Property IsPostBack As Boolean

속성 값

Boolean

클라이언트에서 다시 게시함으로써 페이지가 로드되면 true이고, 그렇지 않으면 false입니다.true if the page is being loaded in response to a client postback; otherwise, false.

특성

예제

다음 예제에서는 페이지가 로드 될 때 페이지를 처음으로 렌더링 하 고 있는지 여부를 확인 하기 위해 IsPostBack 속성의 값을 테스트 하는 방법을 보여 줍니다.The following example shows how to test the value of the IsPostBack property when the page is loaded in order to determine whether the page is being rendered for the first time or is responding to a postback. 페이지가 처음으로 렌더링 되는 경우 코드는 Page.Validate 메서드를 호출 합니다.If the page is being rendered for the first time, the code calls the Page.Validate method.

페이지 태그 (표시 되지 않음)는 필수 입력 필드에 대 한 항목이 없는 경우 별표를 표시 하는 RequiredFieldValidator 컨트롤을 포함 합니다.The page markup (not shown) contains RequiredFieldValidator controls that display asterisks if no entry is made for a required input field. Page.Validate를 호출 하면 사용자가 제출 단추를 클릭할 때까지 기다리는 대신 페이지가 렌더링 될 때 별표가 즉시 표시 됩니다.Calling Page.Validate causes the asterisks to be displayed immediately when the page is rendered, instead of waiting until the user clicks the Submit button. 포스트백 후에는 해당 메서드가 Page 수명 주기의 일부로 호출 되기 때문에 Page.Validate를 호출할 필요가 없습니다.After a postback, you do not have to call Page.Validate, because that method is called as part of the Page life cycle.

private void Page_Load()
{
    if (!IsPostBack)
    {
        // Validate initially to force asterisks
        // to appear before the first roundtrip.
        Validate();
    }
}
Sub Page_Load
    If Not IsPostBack
        ' Validate initially to force the asterisks
        ' to appear before the first roundtrip.
        Validate()
    End If
End Sub

설명

다시 게시와 콜백 간의 차이점에 대 한 설명은 다시 게시 하지 않고 클라이언트 콜백 구현을 참조 하세요.For an explanation of the difference between postbacks and callbacks, see Implementing Client Callbacks Without Postbacks.

적용 대상

추가 정보