Page.IsPostBack和Page.IsCallBack有什么区别? [英] What is the difference between Page.IsPostBack and Page.IsCallBack?

查看:1147
本文介绍了Page.IsPostBack和Page.IsCallBack有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到一些代码检查 Page.IsCallBack 但我不知道它是如何不同于 Page.IsPostBack


解决方案

Page.IsCallBack


它获得一个值,表示页面请求是否是回调的结果。它的一个特殊的回传,所以往返总是发生;但是,与传统的回发不同,脚本回调不会重绘整个页面。


Page.IsPostBack / strong>


检查页面是否是第一次访问服务器。与IsCallBack不同,ViewState已更新


请参阅 Page Life Cycle 了解更多细节,显示说明事件顺序的图表



编辑 - 回答您的新问题


将对这两种请求类型返回true。仅当请求是客户端回调时,Page.IsCallback属性才会返回true



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?

解决方案

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

这篇关于Page.IsPostBack和Page.IsCallBack有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆