Validator controls must always have Display="Dynamic"
<p>i've been working on this for some time now but I can't seem to be able to find the answer... Google doesn't really help me today!</p>

<p>I'm working on an C# website that uses a lot of forms with a lot of validation on it. Big forms which have to be typed by hand, (no problems there though).</p>

<p>The problem that I have is that I always want my ValidationControls to have the Display Property set to dynamic.</p>

<p>I have found a work around but I'm not convinced that this is the best solution.</p>

<p>Currently I have a BaseValidatorControlAdapter that sets the validators display type to "Dynamic" like this:</p>

<pre><code>public class BaseValidatorControlAdapter : ControlAdapter
{
    protected override void Render(System.Web.UI.HtmlTextWriter writer)
    {
        System.Web.UI.WebControls.BaseValidator _control = (System.Web.UI.WebControls.BaseValidator)this.Control;
        _control.Display = System.Web.UI.WebControls.ValidatorDisplay.Dynamic;
        base.Render(writer);
    }
}
</code></pre>

<p>This is then triggerd by adding an App_Browser which looks like this</p>

<pre><code>&lt;browsers&gt;
    &lt;browser refID="Default"&gt;
        &lt;controlAdapters&gt;
            &lt;adapter controlType="System.Web.UI.WebControls.BaseValidator"
                     adapterType="BaseValidatorControlAdapter" /&gt;
        &lt;/controlAdapters&gt;
    &lt;/browser&gt;
&lt;/browsers&gt;
</code></pre>

<p>My question for you is. Is it possible for me to set the default value of Display for any validator control. Because my current solution just overrides what there is right now and there is no way of changing that. Therefor when the situation arrises that I do need something else then dynamic in the display option there is no solution for it.</p>

<p>I'm almost convinced that there is a better solution to this.</p>

<p>Any advice is appreciated!</p>

<p><strong>Edit august 2nd 2012:</strong></p>

<p>I finally settled with the solution to override the default asp.net controls and add the following constructor to them</p>

<pre><code>public controlname ()
  : base ()
{
    this.Display = "Dynamic";
}
</code></pre>

<p>I added all these controls to a namespace and now I can do</p>

<pre><code>&lt;validator:RequiredField ID="RqrdFld_x" runat="server" Display="Static" /&gt;
</code></pre>

<p>Essentially overriding the default value in my control definition and overriding the default control Display value of Dynamic in the constructor.</p>
