In ASP.NET webpage, I have set the EnableViewState to false to the page and all the controls of the page. Still I am getting the PostBack data in the Controls.
在ASP.NET网页中,我将EnableViewState设置为false为页面和页面的所有控件。我仍然在控件中获取PostBack数据。
Is there any way to remove this? How do we remove the page life cycle event like restore PostBackData? Actually _ViewState is maintained for all controls. I am not clarified from MSDN as well.
有什么办法可以删除吗?我们如何删除页面生命周期事件,如恢复PostBackData?实际上,为所有控件都维护_ViewState。我也没有从MSDN中澄清过。
2 个解决方案
#1
0
Postback data has nothing to do with ViewState.
回发数据与ViewState无关。
If you don't want Postback data, why are you using Post? What are you trying to achieve?
如果您不想要Postback数据,为什么要使用Post?你想要达到什么目的?
#2
0
Because you re-bind your datas after each PostBack
因为您在每次PostBack后重新绑定数据
You can use !IsPostBack
in your Bind
您可以在绑定中使用!IsPostBack
if(!IsPostBack)
{
//Bind your datas just for load, and disable your ViewState, that will erase your selected datas
}
#1
0
Postback data has nothing to do with ViewState.
回发数据与ViewState无关。
If you don't want Postback data, why are you using Post? What are you trying to achieve?
如果您不想要Postback数据,为什么要使用Post?你想要达到什么目的?
#2
0
Because you re-bind your datas after each PostBack
因为您在每次PostBack后重新绑定数据
You can use !IsPostBack
in your Bind
您可以在绑定中使用!IsPostBack
if(!IsPostBack)
{
//Bind your datas just for load, and disable your ViewState, that will erase your selected datas
}