step values to my textArea and pass it to me with HTML tags

0

When I pass the values it shows me with the HTML tags any text that I write THANKS in advance

backend

protected void Button1_Click(object sender, EventArgs e)
{
    try
    {
        if (!String.IsNullOrEmpty(textArea1.InnerText))
        {
            Texto1.InnerText = textArea1.InnerText;
            lblTest.Text = textArea1.InnerText;
            TextBox1.Text = textArea1.InnerText;
        }
    }
    catch (Exception ex)
    {
     string aa =   ex.Message;
        lblTest.Text = aa;
    }

frontend

    <div class="adjoined-bottom">
        <div class="grid-container">
            <div class="grid-width-100">

                <textarea  id="textArea1" name="editor" runat="server" class="ckeditor">

               </textarea>

            </div>
        </div>
    </div>

editor

<script type="text/javascript">
    initSample();
</script>

<asp:Button ID="Button1" runat="server" Text="Pasar Email" OnClick="Button1_Click" /> 
<br />
<br />
<br />

<textarea  id="Texto1" rows="10" runat="server"></textarea>
<br />

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<br />

<br />
<asp:Label ID="lblTest" runat="server" Text="Label"></asp:Label>
<br />

<br />

    
asked by Dieguito Weed 13.09.2018 в 18:03
source

1 answer

0

One option would be to treat the text with a regular expression:

if (!String.IsNullOrEmpty(textArea1.InnerHtml))
{
    string plainText = Regex.Replace(textArea1.InnerHtml, "<.*?>", string.Empty);
    Texto1.InnerText = plainText;
    lblTest.Text = plainText;
    TextBox1.Text = plainText;
}
    
answered by 14.09.2018 в 13:47