RadTextBox, HTML Text, and AJAX

2 posts, 0 answers
  1. Xorcist
    Xorcist avatar
    98 posts
    Member since:
    Apr 2009

    Posted 14 Jan 2010 Link to this post

    Typing anything close to HTML into a RadTextBox seems to break it when it goes over the wire. I've tried escaping (encoding) it via javascript in the OnRequestStart, but that didn't seem to work... any ideas on the proper way to handle this (and without using a RadEditor).
  2. Dimo
    Dimo avatar
    8486 posts

    Posted 15 Jan 2010 Link to this post

    Hi Xorcist,

    The problem is caused by security restrictions in the ASP.NET framework and is not directly related to RadTextBox. Please refer to:


    Since there is no good and proper way to intercept postbacks and change submitted values on the fly, I can suggest you to use some custom client event (e.g. a button click) and encode values before the actual submit action.

    If you prefer using more hackish methods, here are two for you:

    1.  Override the  WebForm_OnSubmit  function, which handles all postbacks. For example


    2. Change the value of the request body on the fly:

    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <head runat="server">
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>No Title</title>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <asp:TextBox ID="TextBox1" runat="server" />
            <asp:Button ID="Button1" runat="server" Text="AJAX" />
    <script type="text/javascript">
    function initializeRequestHandler(sender, args)
        var requestBody = args.get_request().get_body();

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top