ASP.Net controls (e.g. asp: Label) generate html random identifiers (e.g. ct100_ct100_Yabba_Dabba_Doo_FinallyTheRealId). Yes, they are ugly, but someone told me today that they also:
- SEO unfriendly
- increase page size
I half believe 1) and half don't believe. I know that certain names of names (for example, "title") are keywords that search engines will use to generate meta-information, but I am more skeptical that the range with id = "author" really affects SEO. I agree to admit that I am wrong.
At point 2), I'm at least 90% skeptical. Most of the page size is not html characters, and I really wonder if 100 longer 1kb identifiers will add to the page size.
I can go with one of two approaches. Which approach would you take?
Approach 1)
<asp:Label id="lblAuthor" runat="server"></asp:Label>
with code for
protected void Page_Load(object sender, EventArgs e)
{
lblAuthor.Text = "Superman";
or
Approach 2)
<span id="author"><%# Eval("Author") %></span>
with code for
public string Author { get; private set; }
protected void Page_Load(object sender, EventArgs e)
{
Author = "Superman";
On the one hand, 1) does not generate unpleasant identifiers. On the other hand, I always hated untyped strings in asp.net web forms and avoided them whenever I could. Also, if the page contains 30 elements, I get 30 page properties, which makes me feel awkward. (Side note: reason to love how the model works in the MVC pattern).
We work in .Net 3.5.
What are your thoughts?
Thank.