ASP Control names in resulting HTML

  • Thread starter Anatoli Trifonov
  • Start date
A

Anatoli Trifonov

Hi all

Please point me to a link if this can be changed, fixed or something

I have the following control in my UserControl

<img src="pic/dot.gif" border="0" width="50" height="50"
id="imgCenterImage" runat="server" alt="">

After aspx runs through

imgCenterImage.Src = bla bla bla
imgCenterImage.Width = iImageWidth
imgCenterImage.Height = iImageHeight
imgCenterImage.Alt = bla bla bla

Result is this in HTML

<img src="pic/icon_top_how_we_can.gif"
id="_ctl0_ctrlTopMenu__ctl2_imgCenterImage" border="0" width="95"
height="72" alt="How We Can Help" />


Is there any way to control the resulting ID?
This line
id="_ctl0_ctrlTopMenu__ctl2_imgCenterImage"
makes aspx unusable for creation of web sites for search engines

ID starting with "_" is not allowed in

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Thanks

--
_____________________________________
Anatoli Trifonov
Software Developer & Consultant

Minds are like parachutes - they only function when open.
--Thomas Dewar
 
J

John Saunders

Anatoli Trifonov said:
Hi all

Please point me to a link if this can be changed, fixed or something

I have the following control in my UserControl

<img src="pic/dot.gif" border="0" width="50" height="50"
id="imgCenterImage" runat="server" alt="">

After aspx runs through

imgCenterImage.Src = bla bla bla
imgCenterImage.Width = iImageWidth
imgCenterImage.Height = iImageHeight
imgCenterImage.Alt = bla bla bla

Result is this in HTML

<img src="pic/icon_top_how_we_can.gif"
id="_ctl0_ctrlTopMenu__ctl2_imgCenterImage" border="0" width="95"
height="72" alt="How We Can Help" />


Is there any way to control the resulting ID?
This line
id="_ctl0_ctrlTopMenu__ctl2_imgCenterImage"
makes aspx unusable for creation of web sites for search engines

Really? You know of a search engine which chokes on the leading "_"? Please
tell us which one.
ID starting with "_" is not allowed in

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Your "imgCenterImage" id is being changed because it is inside of some
control which implements INamingContainer. THat control appears to have a
defaulted id of "_ctl2". It is inside of "ctlTopMenu", which is inside of
"_ctl0". You should locate the control which is being called "_ctl0" and
give it an explicit id.
 
A

Anatoli Trifonov

Thanks for your help.
Really? You know of a search engine which chokes on the leading "_"? Please
tell us which one.

What do you mean by "chokes"? Page will be indexed of course.
Question is how ...


--
_____________________________________
Anatoli Trifonov
Software Developer & Consultant
Minds are like parachutes - they only function when open.
--Thomas Dewar
 
J

John Saunders

Anatoli Trifonov said:
Thanks for your help.


What do you mean by "chokes"? Page will be indexed of course.
Question is how ...

But will there be any difference in how its indexed between a leading "_" in
the id and no leading "_". In what way will the "_" make a difference?
 
A

Anatoli Trifonov

John Saunders said:
But will there be any difference in how its indexed between a leading "_" in
the id and no leading "_". In what way will the "_" make a difference?
If you declare that page uses HTML 4.0 or 4.1 then
ID="_bla_bla_bla" is not allowed in HTML 4.0 or 4.1.

I'm under assumption that search engine checks for things like this.

Anatoli Trifonov
 
J

John Saunders

Anatoli Trifonov said:
"_"
If you declare that page uses HTML 4.0 or 4.1 then
ID="_bla_bla_bla" is not allowed in HTML 4.0 or 4.1.

I'm under assumption that search engine checks for things like this.

I think that this would be a false assumption. I can't think of any way in
which checking for standards compliance would benefit a search engine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top