RadButton and W3C HTML Validation

6 posts, 1 answers
  1. Marian
    Marian avatar
    49 posts
    Member since:
    Sep 2008

    Posted 07 Sep 2011 Link to this post

    Hi to all,
    I validated my XHTML Transitional page using W3C online validator and following error comming from RadButton was obtained
    Line 192, Column 289: there is no attribute "align" 
    …><span class="rbText rbPrimary" align="center">Obsah spravodajcu []</span><inp…✉ 
    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using ....

    My Radbutton is defined in markup:
    <td style="width:190px;white-space:nowrap;text-align:right">
       <telerik:RadButton ID="btnDoc" runat="server" ButtonType="LinkButton" Width="190px"
            Text='<%# "Obsah spravodajcu [" + Utils.GetFileLengthFriendly(Server.MapPath("~/Documents/" +  Eval   ("Document"))) + "]" %>' NavigateUrl='<%# "~/Documents/" +  Eval("Document")%>' Target="_blank" Visible='<%# Eval("Document") != null %>' CausesValidation="false" CssClass="unwrapped">
            <Icon PrimaryIconUrl="~/Styles/icon_pdf.png" />
        </telerik:RadButton>    
     </td>

    I can not find the reason why not allowed attribute align="center" is rendered for relevant span tag.
    Any idea?
    Thanks
    -Marian
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 09 Sep 2011 Link to this post

    Hello Marian,

    The reason align is not allowed for non-table elements, is because it's not proper XHTML syntax. You're supposed to use float instead to align elements.

    Now, I don't understand why your RadButton would have align text on the text property because I don't see it anywhere on the demo pages. Are you adding it yourself or is that how the control is rendering automatically?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 12 Sep 2011 Link to this post

    Hello Kevin,

    Could you please elaborate how exactly do you perform the validation with the W3C validator? If you do it by URI (Validate by URI), then the W3C validator might present itself to the ASP.NET server as a very old browser, and that's why such attributes get applied to the <span/> element. Could you please view the page in some of the modern browsers (FireFox, IE9, Chrome), then View the Source of the page, copy it and "Validate by Direct Input"? I performed that and everything was OK.

    Best wishes,
    Pero
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Marian
    Marian avatar
    49 posts
    Member since:
    Sep 2008

    Posted 13 Sep 2011 Link to this post

    Hello Kevin & Pero,

    thanks for your reply.
    @Kevin: As you can see my markup, I do not put align property myself. It is rendered automatically - better to say w3c validator has found this property. Nevertheless if I open Show Source window in my IE8 browser no such property can be found. I am little confused in this matter.

    @Pero: I use online validator http://validator.w3.org/check?uri=http%3A%2F%2Fwww.radola.sk%2Fobec%2Fbulletins&charset=%28detect+automatically%29&doctype=Inline&group=0&No200=1&user-agent=W3C_Validator%2F1.2
    Page is online, you can inspect it.

    Thanks
    -Marian
  6. Answer
    Pero
    Admin
    Pero avatar
    1156 posts

    Posted 14 Sep 2011 Link to this post

    Hi Marian,

    As I said in my previous reply, the W3C validator (http://validator.w3.org) presents itself to the web server as a very old browser, and that's why the RadButton renders such HTML. Render the page in some modern browser (FireFox, Chrome, Safari, IE9, Opera), view the page source and then validate it by direct input. You will notice that everything is OK. Here is a video showing this: http://screencast.com/t/dYcbQ9tXhev.
    We can configure the ASP.NET to perceive the W3Validator as a more capable browser by including a .browser file in the App_Browsers file. I have attached such file to the thread. Please include it in your application and test to see if you get the same behavior.

    Best wishes,
    Pero
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Marian
    Marian avatar
    49 posts
    Member since:
    Sep 2008

    Posted 14 Sep 2011 Link to this post

    Hi Pero,

    thanks for your excellent explanation. Now is validation OK.
    -Marian
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017