Posted By: Custa1200 | Jun 20th, 2006 @ 11:02 PM
page 1 of 1
Comments: 12 | Views: 13500
Custa1200
Custa1200
Havok13andaThird
How does one apply the "title" attribute to all the .NET controls? The HTML/XHTML spec says that it is available for most elements. information of the attibute is found here  For one thing All links should havea title attribute for accesibilty and search engines etc... so why is it that when I add the attribute to an asp:linkbutton or any other controls is sees it as an invalid attribute. The asp:linkbutton gets rendered as an anchor tag. which according to the W3C, title is definitelyt available to it as seen here.

Has anybody extended the control to accomodate valid XHTML?
blowdart
blowdart
Peek-a-boo
Custa1200 wrote:
How does one apply the "title" attribute to all the .NET controls? The HTML/XHTML spec says that it is available for most elements. information of the attibute is found here  For one thing All links should havea title attribute for accesibilty and search engines etc... so why is it that when I add the attribute to an asp:linkbutton or any other controls is sees it as an invalid attribute. The asp:linkbutton gets rendered as an anchor tag. which according to the W3C, title is definitelyt available to it as seen here.

Has anybody extended the control to accomodate valid XHTML?


The asp:HyperLink control (and most of the others) has the ToolTip attribute. That should, when rendering to a browser that understands XHTML, render as a title attribute on the underlying control. For older browsers it may get spat out as an alt attribute.

(And yes, it's badly named)
Sven Groot
Sven Groot
My name has 9 letters. Coincidence? I think not...
You can add arbitrary attributes to most controls from the code-behind by using the WebControl.Attributes collection.
W3bbo
W3bbo
The Master of Baiters
Custa1200 wrote:
How does one apply the "title" attribute to all the .NET controls? The HTML/XHTML spec says that it is available for most elements. information of the attibute is found here  For one thing All links should havea title attribute for accesibilty and search engines etc... so why is it that when I add the attribute to an asp:linkbutton or any other controls is sees it as an invalid attribute. The asp:linkbutton gets rendered as an anchor tag. which according to the W3C, title is definitelyt available to it as seen here.

Has anybody extended the control to accomodate valid XHTML?


Try using the System.Web.UI.HtmlControls instead of the System.Web.UI.WebControls (since a WebControl doesn't always represent a single XHTML element)

But yeah, as Sven said go with the .Attributes collection.
W3bbo
W3bbo
The Master of Baiters
Custa1200 wrote:
Thanx guy's, I'll try them tomorrow. Sounds like I should look at the tooltip. I still don't understand why MS have to change names for stuff that has been spec of web for years. We are currently going through a pretty big 1.1 to 2 migration so it's time to cleanup as best as possible.


It's because Microsoft dumbed down HTML with their "Web Controls".

The title="" attribute doesn't have to be displayed as a tooltip, but because that's how IE renders it, and that's how people who develop in design view "want to see" then Microsoft decideded to differ.

Besides, when a WebControl emits more than one XHTML element, which one gets the title="" attribute set?
blowdart
blowdart
Peek-a-boo
W3bbo wrote:


It's because Microsoft dumbed down HTML with their "Web Controls".

The title="" attribute doesn't have to be displayed as a tooltip, but because that's how IE renders it, and that's how people who develop in design view "want to see" then Microsoft decideded to differ.

Besides, when a WebControl emits more than one XHTML element, which one gets the title="" attribute set?


Mozilla renders the title tag thus as well.

And the containing tag would get the attribute set, as you would expect.
W3bbo
W3bbo
The Master of Baiters
blowdart wrote:
Mozilla renders the title tag thus as well.

And the containing tag would get the attribute set, as you would expect.


But you cannot guarantee that the control will do that (well, not without looking at it's source in Reflector).

Y'see, this is why I hate WebControls, it's all dumbed down.

<asp:Login /> Ha!

Give me:

<fieldset>
<legend>Login</legend>
<dl>
<dt><label for="txtUsername">Username</label></dt>
<dd><input id="txtUsername" type="text" /></dd>
<dt><label for="pwdOne">Password</label></dt>
<dd><input id="pwdOne" type="password" /></dd>
</dl>
<button type="submit">Login</button>
</fieldset>

Any day Smiley
blowdart
blowdart
Peek-a-boo
W3bbo wrote:


<fieldset>
<legend>Login</legend>
<dl>
<dt><label for="txtUsername">Username</label></dt>
<dd><input id="txtUsername" type="text" /></dd>
<dt><label for="pwdOne">Password</label></dt>
<dd><input id="pwdOne" type="password" /></dd>
</dl>
<button type="submit">Login</button>
</fieldset>

Any day Smiley


So you're ignoring the meaning of dl then? It's for term & definition lists, and you've stretch that past the point of breaking with an input.
W3bbo
W3bbo
The Master of Baiters
blowdart wrote:
So you're ignoring the meaning of dl then? It's for term & definition lists, and you've stretch that past the point of breaking with an input.


Talk about "To the letter and not the spirit"

I see <dt><dd> more about things that come in "title / body" pairs, which form fields do, they're asking the user to "define" that field title for themselves.

Maybe it is acceptable to use a <table> for form elements (there were some convincing arguments on Usenet a while ago)
blowdart
blowdart
Peek-a-boo
W3bbo wrote:

blowdart wrote:So you're ignoring the meaning of dl then? It's for term & definition lists, and you've stretch that past the point of breaking with an input.


Talk about "To the letter and not the spirit"

I see <dt><dd> more about things that come in "title / body" pairs, which form fields do, they're asking the user to "define" that field title for themselves.

Maybe it is acceptable to use a <table> for form elements (there were some convincing arguments on Usenet a while ago)


Well indeed; you're the one that's normally so strict about these things.

I have a site with an event list, with <dt> as the event title and <dd> as the details, which I can just about accept.

However title/body pairs for forms is pretty much what <label> is there for.
W3bbo
W3bbo
The Master of Baiters
blowdart wrote:
I have a site with an event list, with <dt> as the event title and <dd> as the details, which I can just about accept.

However title/body pairs for forms is pretty much what <label> is there for.


you don't have to wrap the input in the label, what do you use to separate each field?
blowdart
blowdart
Peek-a-boo
W3bbo wrote:

blowdart wrote:I have a site with an event list, with <dt> as the event title and <dd> as the details, which I can just about accept.

However title/body pairs for forms is pretty much what <label> is there for.


you don't have to wrap the input in the label, what do you use to separate each field?


I'm not saying you do. And you seperate the field with what you like. Make a break after the label if you want, but don't highjack the semantics of a tag just to fit your layout ideals. That's as bad as using tables.
page 1 of 1
Comments: 12 | Views: 13500
Microsoft Communities