Thomas Bandt

Über mich | Kontakt | Archiv

[ASP.NET 2.0] The 'SelectedValue' property cannot be set declaratively

Kleiner Trick zum Vorbelegen einer DropDownList, sprich Selectbox, wenn diese automatisch gefüllt wird (DataSource o.ä.) aber mit einem feststehenden Wert vorbelegt werden soll:

SelectedValue='<%# "164" %>'

Funktioniert, auch wenn SelectedValue von IntelliSense gekonnt verschwiegen wird. Andernfalls tritt dann oben genannter Fehler auf.

Kommentare

  1. Shane Shepherd schrieb am Dienstag, 27. Juni 2006 20:56:00 Uhr:

    @Thomas - Great tip. I'm trying to figure out how to Bind() to a RadioButtonList when one of the possible returned values is NULL. I would like the control to ignore setting the SelectedValue if it is null. Any tips on this?


« Zurück  |  Weiter »