我们何时使用以及在何处使用if(IsPostBack)& if(!IsPostBack)属性? [英] when we use and where to use if(IsPostBack) & if(!IsPostBack) properties?

查看:94
本文介绍了我们何时使用以及在何处使用if(IsPostBack)& if(!IsPostBack)属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们

If(IsPostBack)和If(!IsPostBack)的用途是什么?

给我实时示例吗?


感谢U.

Hi Friends

what is the use of If(IsPostBack) & If(!IsPostBack)?

Give me Real time examples?


Thanking U .

推荐答案

Page.IsPostBack是一个属性,用于指示页面是第一次加载还是由于某些用户交互而加载.如果是第一次,则要设置文本字段的默认值,依此类推-如果不是,则不要,因为那样会覆盖用户键入的值.

通常,仅在Page.Load事件中需要它.

在MSDN上阅读: http://msdn.microsoft.com/zh-CN/library/system.web.ui.page.ispostback(v=vs.100).aspx [
Page.IsPostBack is a property which indicates whether the page is loading for the first time, or as a result of some user interaction. If it is the first time, then you want to set default values for text fields and so on - if it isn''t, you don''t because that would overwrite the values the user typed.

Generally, it is only needed in the Page.Load event.

Read up on MSDN: http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback(v=vs.100).aspx[^]


这篇关于我们何时使用以及在何处使用if(IsPostBack)& if(!IsPostBack)属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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