Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've recently ran into some code that checks Page.IsCallBack but I wasn't sure how it is different from Page.IsPostBack. Can anyone enlighten me?

Edit: Are they mutually exclusive or can both occur at the same time in a given situation?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
621 views
Welcome To Ask or Share your Answers For Others

1 Answer

Page.IsCallBack

It is getting a value indicating whether the page request is the result of a call back. Its a special postback, so a round-trip always occurs; however, unlike the classic postback, the script callback doesn't redraw the whole page. ViewState is not updated during a callback, it is for postback.

Page.IsPostBack

Checks whether the Page is accessing the server for the first time or not. Unlike the IsCallBack, the ViewState is updated

Refer to Page Life Cycle for more detail that shows a diagram illustrating the sequence of events

Edit - To answer your new question

Page.IsPostback property will return true for both request types. The Page.IsCallback property will return true only when the request is a client callback


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...