locked
Break Tag is malformed when editing my ascx in the wsyinwyg [sic] EW 4.0 RRS feed

  • Question

  • Hi. inside the code that defines a control (ascx) l have created:
    I have this line (could be any line , I picked this one randomly)

    Stuff elided....
    <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label><br/>
    Stuff elided...

    note the <br/> tag is xhtml compliant and wellformed. It is so because I adjusted it by hand to be xhtml compliant... So, how come if I press [Enter] in the wsyinwyg i get a <br> rather than an xhtml compliant self closing tag?

    Surely there is some setting somewhere to fix this?
    Or am I really going to have to enter/fix each tag by hand.
    Or do some compliancy check post creation? surely not...

    Thanks for any light you can shed on this dark place.
    Fervently awaiting some inspiration in this matter
    (heh, i love it when people put stupid stuff like that at the end of their posts, and mean it. lol)

     


    I came, I saw, I coded
    Monday, July 5, 2010 11:44 AM

Answers

  • OK, so you don't have a doctype which is why EW doesn't know to put the trailing slash in. Once you have the control on a page that has an XHTML doctype, EW will use the correct syntax.

     


    Ian Haynes

    EW V4 Add-Ins
    EW resources, hints and tips
    Monday, July 5, 2010 2:31 PM
  • Look at your page editing settings in EW:  Tools -> Page Editor Options -> General tab.  Make sure you've selected an XHTML doctype declaration, if that's what you want your default to be.

    New non-child aspx pages will be created with that doctype.  New Master pages will be created with that doctype, and child pages made from that master page will use the master page's doctype.

    HOWEVER:  For ascx pages, there is no Doctype on the page when EW creates it (nor should there be), and EW doesn't appear to use the default Editor setting without one.

    If your doctype and secondary schema are set to XHTML, it will complain to you about the <br> it just put in, but it won't know to put <br /> in instead....  It will do the same thing if you create an html page and remove the doctype: it will put in <br>, but complain about it.

    Monday, July 5, 2010 3:51 PM

All replies

  • Is the page generated from a MasterPage? What's the doctype of the page or master?
    Ian Haynes

    EW V4 Add-Ins
    EW resources, hints and tips
    Monday, July 5, 2010 1:21 PM
  • <%@ Control Language="C#" AutoEventWireup="true" CodeFile="emailcontrol.ascx.cs" Inherits="MyControls_emailcontrol" %>
    <h2>
        <asp:Label ID="Label1" runat="server" Text="Send us a message"></asp:Label>&nbsp;</h2>
    <asp:Label ID="Label3" runat="server" Text="Your email :"></asp:Label>
    <br />
    <asp:TextBox ID="txtEmail" runat="server" Width="200px" ></asp:TextBox>
    <br />
    <asp:Label ID="txtName" runat="server" Text="Your name :"></asp:Label>
    <br />
    <asp:TextBox ID="TextBox1" runat="server" Width="200px"></asp:TextBox>
    <br />
    <asp:Label ID="Label4" runat="server" Text="Message :"></asp:Label>
    <br>
    <asp:TextBox ID="txtMessage" runat="server" Rows="4" TextMode="MultiLine" Width="200px"></asp:TextBox>
    <br />
    <asp:Button ID="btnSend" runat="server" Text="Send" onclick="btnSend_Click" Width="200px" />
    <br />
    <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label><br/><br/>

    is the complete control.

    no prizes for guessing its function.
    The backing code store just says (in a nutshell) post to smtp server.

    It lives in a website that runs Sitefinity, but it doesnt reference anything at the moment - it just sits there stand alone until i plug it in to something.

    Thanks for replying!


    I came, I saw, I coded
    Monday, July 5, 2010 1:46 PM
  • OK, so you don't have a doctype which is why EW doesn't know to put the trailing slash in. Once you have the control on a page that has an XHTML doctype, EW will use the correct syntax.

     


    Ian Haynes

    EW V4 Add-Ins
    EW resources, hints and tips
    Monday, July 5, 2010 2:31 PM
  • Look at your page editing settings in EW:  Tools -> Page Editor Options -> General tab.  Make sure you've selected an XHTML doctype declaration, if that's what you want your default to be.

    New non-child aspx pages will be created with that doctype.  New Master pages will be created with that doctype, and child pages made from that master page will use the master page's doctype.

    HOWEVER:  For ascx pages, there is no Doctype on the page when EW creates it (nor should there be), and EW doesn't appear to use the default Editor setting without one.

    If your doctype and secondary schema are set to XHTML, it will complain to you about the <br> it just put in, but it won't know to put <br /> in instead....  It will do the same thing if you create an html page and remove the doctype: it will put in <br>, but complain about it.

    Monday, July 5, 2010 3:51 PM