Is this a bug in ASP.NET 3.5?
<p>In ASP.NET when I try to add a dynamic control (includes validation) to <code>Placeholder</code> or any other control container, the name of control become an important. For example, this is very normal, easy control adding code.</p>

<pre><code>var control = LoadControl("TestUserControl.ascx");
control.ID = Guid.NewGuid().ToString();
PlaceHolder1.Controls.Add(control);
</code></pre>

<p>as you see, I'm giving guid to control's ID. In Runtime, this code fails, and compiler says this is a javascript error, and error message like ';' character expected, missing.. etc..</p>

<p>The problem is very interesting. Dynamically added ASP.NET control (includes validation), causes an error because of " - " character in dynamically named ID property (or anything like '-', '.',etc..).</p>

<p>When I refine my code like:</p>

<pre><code>var control = LoadControl("TestUserControl.ascx");
control.ID = Guid.NewGuid().ToString().Replace("-", string.Empty);
PlaceHolder1.Controls.Add(control);
</code></pre>

<p>problem goes away :)</p>

<p>Is this a bug in <strong>ASP.NET 3.5</strong>? Why its look like a javascript error in page?</p>
