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?

Comments

# re: Things that make you go hmmm....

Tuesday, March 09, 2004 6:11 PM by J. Walker

The only thing I notice is that the control is prefixed as <sdp: and the listitems are pre-fixed as <asp: . I take it this is a custom control where you are inheriting from another control. I haven't tested, but shouldn't the listitems be prefaced by <sdp: ?

# re: Things that make you go hmmm....

Tuesday, March 09, 2004 9:40 PM by Chris McKenzie

That's possible. It isn't an inherited control actually--it's a composite. Normally, it just validates what the user enters into a textbox for required field and datatype--but if the developer enters a list of items instead, it renders a dropdown.

Since the ListItemCollection already exists for the dropdown, I thought it'd be fairly simple to just create one for my control, and populate the dropdown list with it if necessary. It didn't occur to me that there might be namespace issues. I may have to create an SDPListItemCollection instead. I'll try your suggestion first thing in the morning.

Whether it works or not, thanks for the advice.

Chris

# Take Outs for 9 March 2004

Wednesday, March 10, 2004 1:43 AM by TrackBack

You've been Taken Out! Thanks for the good post.

# Climbing the mountain.

Thursday, March 11, 2004 9:12 AM by TrackBack

# Climbing the mountain.

Thursday, March 11, 2004 10:00 AM by TrackBack

Leave a Comment

(required) 
(required) 
(optional)
(required)