文本框控件在回发时保留其值 [英] textbox control retaining its value on postback

查看:73
本文介绍了文本框控件在回发时保留其值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使禁用了控件的视图状态模式,文本框控件如何在回发时保留它的值。如果控件的视图状态模式属性对文本框控件没有任何影响,无论是启用还是禁用,那么为什么这样做属性可用于控件。

解决方案

EnableViewState是真的吗?



Quote:

仅当EnableViewState属性设置为true时,页面或控件的ViewStateMode属性才有效。如果EnableViewState属性设置为false,即使ViewStateMode属性设置为Enabled,也将关闭视图状态。


它是两个事件的问题 LoadPostData LoadViewState LoadViewState之后调用LoadPostData 。无论视图状态是打开还是关闭,数据都会在 LoadPostData 事件中填充到控件中。请参阅本文。这肯定会有所帮助你。



为什么文本框在回发期间保持数据,即使视图状态设置为关闭 [ ^ ]



问候......:笑:

how does the textbox control retains it's value on postback even when the view state mode for the control is disabled.if the view state mode property for the control does not have any effect on the textbox control whether enabled or disabled then why this property is available for the control.

解决方案

Is EnableViewState true?

Quote:

The ViewStateMode property of a page or a control has an effect only if the EnableViewState property is set to true. If the EnableViewState property is set to false, view state will be turned off even if the ViewStateMode property is set to Enabled.


Its the matter of two events LoadPostData and LoadViewState.LoadPostData is called after LoadViewState.So irrelative to whether the viewstate is on or off,data gets populated into control at LoadPostData event.Refer to this article.It will definitely help you.

Why textbox persists data during postback even if View State set to off[^]

Regards.. :laugh:


这篇关于文本框控件在回发时保留其值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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