Page is a not externally linkable
- Microsoft
-- Microsoft IIS Web Server and ASP.NET
---- Share your pet microsoft development hates


marcel - 4:53 pm on Nov 3, 2008 (gmt 0)


If you have three DIV's with runat="sever" set, you can end up with an ID of DIV1_DIV2_MyID, when all you want is MyID for use with JavaScript. Drives me nuts that I have a span tag in my page that has an ID twenty or thirty characters in length, when all I want is SPAN1. This is some serious bloat.

You shouldn't be adding a runat="server" to divs and spans, try using Literals and Placeholders instead, as they don't create a client side ID. (If you want to manipulate the span or id with js you can try adding a span or div with an id, (without the runat='server') within the placeholder in code before)

Also, replacing Labels with literals will also save you the problem of client side IDs


Thread source:: http://www.webmasterworld.com/microsoft_asp_net/3736439.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com