在 ASP.NET 中禁用控件与隐藏控件

发布于 2024-10-25 17:07:45 字数 164 浏览 1 评论 0原文

从用户界面设计的角度来看,什么时候禁用控件或完全隐藏它更好。我附上了一个例子。在这两种情况下,如果单击“启用 ASP.NET”复选框,则会启用“选择 .Net 版本选择器”。

Comparison

From a User Interface design point of view when is it better to disable a control or to completely hide it. I have attached an example. In both case if the "Enable ASP.NET" checkbox is clicked the "Select. Net Version selector is enabled.

Comparison

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

罪歌 2024-11-01 17:07:45

我认为禁用几乎总是最好的。隐藏控件意味着您的部分功能/可配置性对最终用户来说是个谜。除非有令人信服的理由让用户蒙在鼓里,否则我不会。

您的启用/禁用或隐藏/取消隐藏下拉框的复选框示例是一个很好的示例。如果用户不知道选中该框允许他们选择更多选项,他们可能永远不会检查它并找出答案,因为他们没有意识到他们正在寻找的选项就在那里。

作为开发人员,我们中的许多人在使用软件时都抱着“尝试一切”的心态。普通用户不这么认为,这也不是一件坏事。这只是意味着我们必须记住,并不是每个人都会采取一切措施来发现隐藏的 UI 部分。将其保持可见但禁用,可以让他们看到如果他们决定想要/需要使用它,可以拥有一些东西,而不是让他们想知道该软件是否可以做某事,或者甚至从不考虑它可能会做。

I would argue that it's almost always best to just disable. Hiding controls means you're leaving a portion of your functionality/configurability a mystery to the end-user. Unless there's a compelling reason to keep users in the dark, I wouldn't.

Your example of a checkbox that enables/disables or hides/unhides a dropdown box is a good one. If users aren't aware that checking the box allows them to select further options, they may never check it and find out, because they don't realize the option they're looking for is there.

Many of us, as developers, come from the "try everything" mindset when it comes to using a piece of software. Normal users don't think that way, and that's not a bad thing, either. It just means we have to keep in mind that not everybody will do what it takes to discover a piece of UI that's been hidden. Leaving it visible but disabled lets them see that there's something there for the having should they decide they want/need to use it, rather than leaving them either wondering if the software does something or never even considering that it might.

不必了 2024-11-01 17:07:45

这实际上取决于示例的上下文。在这种情况下,禁用该控件具有一定的价值,因为它提供了视觉效果,启用 ASP .Net 复选框将产生可确定的结果。

如果复选框的结果实际上是一系列不相关的子选项,或者父控件是一个下拉列表,它确定哪些子元素可用,那么最好只隐藏/显示那些适合当前选择的元素。

另一点,如果您在代码中将控件描述为 control.visible = false 而不是 display:none ,那么请记住输出实际上根本不会呈现到浏览器中。如果您正在为残疾用户提供需要更严格的可访问性要求等的浏览器,这可能是一个问题。

This really depends on the context of the example. In this case there is some value associated with disabling the control as it provides a visual affordance that enabling the ASP .Net checkbox will have a determinable outcome.

If the outcome of the checkbox is actually a whole series of non related suboptions or the parent control was a dropdownlist which determines which child elements become available then it would be better to hide / show only those elements that are appropriate to the current selection.

One other point, if you are describing "hiding" the controls as control.visible = false in code rather than display:none then remember that the output will actually not be rendered into the browser at all. This may be a concern if you are catering for disabled users with browsers requiring stricter accessibility requirements etc.

廻憶裏菂餘溫 2024-11-01 17:07:45

对我来说,这取决于用户的知识。如果用户知道应该遵循什么,我倾向于向他们提供尽可能多的信息,以便我将其显示为禁用。如果用户对接下来的内容一无所知,我会尽可能隐藏。有时我会根据用户角色做不同的事情,有时这取决于应用程序的普通用户以及他们对潜在问题的预期理解。

hth,

\^/生病了

To me that depends on user knowledge. If the user knows what should follow I tend to give them as much information as possible so I would show it disabled. If the user is clueless as to what follows I hide as much as possible. Sometimes I do different things on user role and sometimes it depends on the average user of the application and their expected understanding of the underlying issues.

hth,

\ ^ / i l l

夜深人未静 2024-11-01 17:07:45

我更喜欢禁用该控件,以便用户可以看到他可能需要填写一些内容。但如果空间有限,隐藏它可能会很有用。

这确实取决于具体情况

I prefer to disabled the control, so the user can see that he may have something to fill out. But it can be usefull to hide it if you are restricted on space.

It really depends on the situation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文