Custom control that detects first child which will be rendered as a html input field
<p>Im trying to develop a custom control that automatically detects the first child control which will be rendered as an input-tag. I'm doing this because I want to know if I should render my associated title as a label or a span element in the HTML (a bit like the <code>asp:Label</code> works when an <code>AssociatedControlID</code> is given).</p>

<p>I found that most of the <code>HtmlControls</code> that will be rendered as an input field derives from the base class <code>HtmlInputControl</code>. But I didn't find any class alike for the controls in the <code>System.Web.UI.WebControls</code> namespace.</p>

<p>So my question is, am I stuck with digging up the protected property "TagKey" with reflection like this:</p>

<pre><code>var property = control.GetType()
    .GetProperty("TagKey", BindingFlags.NonPublic | BindingFlags.Instance);
var tag = (HtmlTextWriterTag)property.GetValue(control, null);
</code></pre>

<p>or have I missed something?</p>
