Things that make you go hmmm....
As (a very small) some of you may know, I have been developing an dynamic UI rendering control for SQL Server Reporting Services in ASP .NET. Given a report, the control will obtain a list of report parameters, and dynamically render UI and validation elements based on datatype and other properties of Report Parameters. This control basically functions like a table, where each cell contains all the UI bits for each parameter. Each collection of UI bits (a Value webcontrol, a Required Field validator, a Datatype validator, and a Set-Value-To-Null checkbox) is itself wrapped up into a self-contained server control that loads itself from a parameter. It's called RSValidatedInputControl. RSValidatedInputControl inherits from another server control I created called ValidatedInputControl.
For the most part, this system of objects works beautifully. However, I've noticed something very strange.
If ValidatedInputControl has a list of valid values, it renders a dropdownlist as its primary value control. Since it's a dropdownlist, required field and datatype validation are unnecessary, so those two controls are disabled. The ValidValues list is stored as a ListItemCollection internal to the control. The aspx markup is as follows:
<sdp:validatedinputcontrol id=ValidatedInputControl1 runat="server" CanBeNull="False">
<asp:ListItem Value="Text1">Text1</asp:ListItem>
<asp:ListItem Value="Text2">Text2</asp:ListItem>
</sdp:validatedinputcontrol>
I have a page containing only this control and a button. When I click the button, I test Page.IsValid to determine if the validation has passed. Since all the validators are disabled by default, this should return “True.” It doesn't. I checked the validator controls--they are disabled. They are also marked as valid. Why would the page be marked as invalid? I've even stepped through the built-in javascript provided with the validator controls. 25 points to the first person with the correct answer (that was an obvious bid to encourage others to help me answer this question : ) ).
The only thing that I can find that might be the start of an explanation is this. When I look at the aspx markup in HTML view, I get a tooltip to the effect that the page parser doesn't like the <asp: listitem> tags. “The active schema does not support the element '<asp:listitem>'”.
Whaddya' think?