Making a treeview mimic required field validator functionality
<p>I am in need of validating a TreeView to make sure that users have selected something.  What I need is something that mimics a RequiredFieldValidator and stops a page from posting back with any data until something is selected.</p>

<p>I am using C# and ASP.NET 3.5</p>

<p>I have tried this and it did not work for me:</p>

<pre><code>if (TreeView.SelectedNode.Value == null)
    {
       lblError.Text = "Required";
       lblError.ForeColor = Color.Red;
    }
</code></pre>

<p>I am at a loss, and any help would be very appreciated.</p>
