在ASP.NET回发问题 [英] Postback issue in ASP.NET

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

问题描述

我有它的Visible属性设置为false一个asp.net标签控件。在code-背后,我的知名度设置为基于用户是否已经或未登录真/假。一个怪异的行为是上回发时,code-后面执行,并设置标签的可见性的价值什么的,然后标记执行并设置标签的可见性设置为false。在非回发请求,状态由code-背后设置是的的覆盖。请原谅我的无知,但我失去了一些重要的东西?

I have an asp.net label control with its Visible property set to false. In the code-behind I'm setting its visibility to true/false based on whether the user has logged in or not. A weird behavior is that on postbacks, the code-behind executes and sets the value of the label's visibility to whatever, and then the markup executes and sets the label's visibility to false. On non-postback requests, the status set by the code-behind is not overwritten. Pardon my ignorance, but am I missing something important?

推荐答案

让我们来了解页面的生命周期,并在各种页面事件被解雇运行

Get to know the page lifecycle, and when the various page events are fired by the runtime.

<一个href=\"http://msdn.microsoft.com/en-us/library/ms178472.aspx\">http://msdn.microsoft.com/en-us/library/ms178472.aspx

另外,我不认为code是微不足道的。如果它是codeD正确,你就不会遇到这个问题。把它放在这里,让我们来看看。

Also, I don't think the code is insignificant. If it were coded properly, you wouldn't be experiencing this problem. Put it up here and let us have a look.

这篇关于在ASP.NET回发问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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