Blog Hero Image

Vorsicht mit Visible = false

This article dates back to 2010. Some of the tech in it is history by now; the article stays online as part of my archive.

AI training  ·  Current trainings

Vorsicht mit Visible = false

Eigentlich altbekannt, trotzdem bin ich gerade mal wieder darauf hereingefallen und schreibe des deshalb hier auf:

Ich wollte in einer ASP.NET Webforms Anwendung ein Servercontrol serverseitig über

meinControl.Visible = false;

ausblenden, um es nach einer Nutzeraktion auf dem Client wieder einzublenden:

$(Id$="MeinControl").show();

Leider funktioniert das allerdings nicht, da ein serverseitiges Visible = false dafür sorgte, dass das Control erst garnicht gerendert wurde und somit auf dem Client nicht verfügbar war.

Die simple Lösung im Codebehind:

meinControl.Style.Add(HtmlTextWriterStyle.Display, "none");

Dann klappts auch mit dem Einblenden ;-)

Inconsistent results with AI tools in your team?

I show developer teams how to turn Copilot, Claude, and Codex licenses into a reproducible development process. In one to two days, remote or in person in Bad Breisig, Germany.

To the AI training

I test the AI tools in real projects. You read what matters in five minutes.

What's changed in Claude Code, Copilot, and the other AI tools, and what it means for .NET teams. Plus news on .NET MAUI and the next book edition. No fixed schedule: I write when there's something worth your time. Unsubscribe anytime.

We send via Brevo. By subscribing you agree to your data being processed by Brevo.