RichTextBox

Discussion in 'ASP.NET / ASP.NET Core' started by nature, Oct 11, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. When using RichTextBox to create the body of an email, I can't get it to correctly include links to my own site (www.sociables.org). It wants to do a relative link. See below.

    Here's the HTML before sending:

    <P><A href="http://discountasp.net/support.aspx">http://discountasp.net/support.aspx</A></P>
    <P><A href="http://www.sociables.org/aboutus/faqAboutUs.aspx">http://www.sociables.org/aboutus/faqAboutUs.aspx</A></P>

    Here's the HTML it actually sends:
    <p><a href="http://discountasp.net/support.aspx">http://discountasp.net/support.aspx</a></p>
    <p><a href="/aboutus/faqAboutUs.aspx">/aboutus/faqAboutUs.aspx</a></p>
     
  2. Here's the code. For all it's worth, I'm using webmatrix to develop the pages.

    <%@ Page Language="VB" validaterequest="false" %>
    <%@ Register TagPrefix="RTB" Namespace="RichTextBoxControl" Assembly="RichTextBox, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=17b15412cfbf13c1" %>
    <script runat="server">

    ' Insert page code here

    sub page_load()

    txtEmail.text = "[email protected]"
    txtName.text = "carl"

    RichTextBox1.ButtonImagePath = "/images/standard"

    if not ispostback then
    pnlMsg.visible = true
    pnlThanks.visible = false
    end if
    End Sub


    Sub btnSend_Click(sender As Object, e As EventArgs)
    ' Build a MailMessage
    Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
    mailMessage.From = txtEmail.text
    mailMessage.To = "[email protected]"
    mailMessage.Subject = dropSubject.SelectedItem.text
    mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html
    mailMessage.Body = RichTextBox1.text System.Web.Mail.SmtpMail.SmtpServer = "localhost"
    System.Web.Mail.SmtpMail.Send(mailMessage)
    pnlMsg.visible = false
    pnlThanks.visible = true
    End Sub

    </script>

    <html>
    <head>
    <title>Example Tabs</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

    </head>

    <form runat="server">

    <h2>Contact Us
    </h2>
    <!-- outer shell table -->
    <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
    <tbody>
    <tr>
    <td valign="top" width="20%">
    <!-- 1st column --></td>
    <td valign="top">
    <!-- 2nd column -->
    <asp:panel id="pnlMsg" runat="server">
    <table height="150" width="300">
    <tbody>
    <tr>
    <td>
    Name</td>
    <td>
    <asp:TextBox id="txtName" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator id="rvalName" runat="server" ErrorMessage="Please enter your name" ControlToValidate="txtName"></asp:RequiredFieldValidator>
    </td>
    </tr>
    <tr>
    <td>
    Email Address</td>
    <td>
    <asp:TextBox id="txtEmail" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator id="rvalEmail" runat="server" ErrorMessage="Please enter your Email address" ControlToValidate="txtEmail"></asp:RequiredFieldValidator>

    <asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid Email!" ControlToValidate="txtEmail" ValidationExpression="\S+@\S+\.\S{2,3}"></asp:RegularExpressionValidator>
    </td>
    </tr>
    <tr>
    <td>
    Subject:</td>
    <td>
    <asp:DropDownList id="dropSubject" runat="server">
    <asp:ListItem Text="Questions about the Sociables" selected="true" />
    <asp:ListItem Text="Report a Problem with the site" />
    <asp:ListItem Text="Feedback on the newsletter" />
    <asp:ListItem Text="Offer to help" />
    <asp:ListItem Text="Exchange links" />
    <asp:ListItem Text="Other Subject" />
    </asp:DropDownList>
    </td>
    </tr>
    <tr>
    <td>
    Your message</td>
    <td>
    <RTB:RichTextBox id="RichTextBox1" runat="server"></RTB:RichTextBox> </td>
    </tr>
    <tr>
    <td></td>
    <td>
    <asp:Button id="btnSend" onclick="btnSend_Click" runat="server" Text="Send"></asp:Button>
    <asp:RequiredFieldValidator id="rvalBody" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="RichTextBox1">Please enter your message</asp:RequiredFieldValidator>
    </td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    </tr>
    </tbody>
    </table>
    </asp:panel>
    <!-- Insert content here -->
    <asp:panel id="pnlThanks" runat="server">Thanks for contacting us! We'll get back to
    you as soon as we can. We're all volunteers doing this in our "spare"
    time, so it may not be right away.</asp:panel>
    </td>
    <td valign="top" width="20%">
    <!-- third column --></td>
    </tr>
    </tbody>
    </table>
    <!-- Insert content here -->
    </form>
    </body>
    </html>


    quote:Originally posted by bruce

    Very weird... so it only does this on your domain.

    Can you post the code?


    quote:Originally posted by nature

    When using RichTextBox to create the body of an email, I can't get it to correctly include links to my own site (www.sociables.org). It wants to do a relative link. See below.

    Here's the HTML before sending:

    <P><A href="http://discountasp.net/support.aspx">http://discountasp.net/support.aspx</A></P>
    <P><A href="http://www.sociables.org/aboutus/faqAboutUs.aspx">http://www.sociables.org/aboutus/faqAboutUs.aspx</A></P>

    Here's the HTML it actually sends:
    <p><a href="http://discountasp.net/support.aspx">http://discountasp.net/support.aspx</a></p>
    <p><a href="/aboutus/faqAboutUs.aspx">/aboutus/faqAboutUs.aspx</a></p>
    </blockquote id="quote"></font id="quote">

    B.

    DiscountASP.NET
    http://www.DiscountASP.NET

    </blockquote id="quote"></font id="quote">
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    Very weird... so it only does this on your domain.

    Can you post the code?


    quote:Originally posted by nature

    When using RichTextBox to create the body of an email, I can't get it to correctly include links to my own site (www.sociables.org). It wants to do a relative link. See below.

    Here's the HTML before sending:

    <P><A href="http://discountasp.net/support.aspx">http://discountasp.net/support.aspx</A></P>
    <P><A href="http://www.sociables.org/aboutus/faqAboutUs.aspx">http://www.sociables.org/aboutus/faqAboutUs.aspx</A></P>

    Here's the HTML it actually sends:
    <p><a href="http://discountasp.net/support.aspx">http://discountasp.net/support.aspx</a></p>
    <p><a href="/aboutus/faqAboutUs.aspx">/aboutus/faqAboutUs.aspx</a></p>
    </blockquote id="quote"></font id="quote">

    B.

    DiscountASP.NET
    http://www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page