No idea why but when I place my custom control in my .aspx page, it's rendering the ID out also. So Consequently, I'm writing out some JavaScript to the page also and right in the middle I get this name of my control so it's messing up my JavaScript.
So in my .aspx I have:
<pm:Car ID="ProductCar" runat="server"/>
And here's what starts to get rendered:
<script type="text/javascript">
var ctl00_mainContent_ProductCar
lastProductID;var ctl00_mainContent_ProductCar
carSize;
...
as you can see ctl00_mainContent_ProductCar is the ID and it's being rendered right after var so I end up with a lastProductID not found error in my JavaScript because the text ctl00_mainContent_ProductCa is in the way.
(updated)
protected override void Render(HtmlTextWriter writer)
{
writer.Write(BuildCarJavaScript());
}
simply outputs a bunch of JavaScript to the page. And nowhere in my JavaScript do I have it just outputting clientID by itself like I'm seeing.
In BuildCarJavaScript here is where I'm creating that code:
carJavaScript.Append(@"<script type=""text/javascript"">" + "\r\n");
carJavaScript.AppendFormat("var {0}lastProductID;", this.ClientID + "\r\n");
...