ASP.NET and JavaScript dynamic show/hide based on other form fields
<p>I seem to keep running into these complex show/hide scenarios in ASP.NET web forms where the logic goes "if Field A equals blah, and Field B equals blahblah, then Field C is shown/hidden/validated/whatever." Before I run off and start building custom validators and custom controls so I can more easily manage it in markup or backend code, are there any libraries or simpler solutions I'm missing out there in the wild? jQuery makes the job easier, but I get the feeling I could abstract a lot of what I'm wrangling with out into a more elegant solution.</p>

<p>All of the controls that are dependent on each other or could trigger events are my own custom controls already, so I get the feeling I could start writing a small framework to handle it like so:</p>

<pre><code>&lt;my:DynamicShowHide runat="server"&gt;
    &lt;PrerequisiteFields&gt;
     &lt;PrerequisiteField ControlId="FieldA" Value="blah" /&gt;
     &lt;PrerequisiteField ControlId="FieldB" Value="blahblah" /&gt;
    &lt;/PrerequisiteFields&gt;
    &lt;DependentFields&gt;
     &lt;DependentField ControlId="FieldC" /&gt;
    &lt;/DependentFields&gt;
&lt;/my:DynamicShowHide&gt;
</code></pre>

<p>...that way if the Prerequisite values were both evaluated as true, the DependentField would show, and hide if not.</p>

<p>It seems (and feels) like I'm overengineering but I run into insanely large and complex decision trees like this more and more often. Anyone know of a better way or an existing library that does something along these lines?</p>
