RadTextBox Cut and Paste IE 7

10 posts, 0 answers
  1. Mark Perry
    Mark Perry avatar
    17 posts
    Member since:
    Mar 2010

    Posted 01 Apr 2010 Link to this post

    In our code when we set TextMode="MultiLine" the user can't copy and paste into the textbox. This happens in IE 7 but seems to be OK in IE 8. Anyone else have this issue? Seems to be OK in Firefox as well.

     

    <telerik:RadTextBox ID="TxtBx" Runat="server" TextMode="MultiLine">

     

    </telerik:RadTextBox>

     

     

     

     

     

     

  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 02 Apr 2010 Link to this post

    Hi Mark,

    Which version of RadControls are you using? Is the problem reproduced on the online demos (which use the latest version)?

    http://demos.telerik.com/aspnet-ajax/input/examples/radtextbox/firstlook/defaultcs.aspx

    Sincerely yours,
    Dimo
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark Perry
    Mark Perry avatar
    17 posts
    Member since:
    Mar 2010

    Posted 02 Apr 2010 Link to this post

    On that test page, if I set Set Max Length to 200 and try to paste it wont work. I'm using IE 7.0.5730.13

  5. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 02 Apr 2010 Link to this post

    Mark, which version of RadControls are you using? The have been problems with pasting in older versions.

    Regards,
    Dimo
    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.
  6. Mark Perry
    Mark Perry avatar
    17 posts
    Member since:
    Mar 2010

    Posted 02 Apr 2010 Link to this post

    2009.3.1314.35
  7. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 05 Apr 2010 Link to this post

    Hi Mark,

    I am sorry, I don't see any problems with pasting inside RadTextBox in IE7 and RadControls 2009.3.1314. I tried pasting with right-clicking the mouse and with Ctrl-V - both worked.

    Please provide a full runnable web page or modify the following until the issue is reproduced:

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!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>RadControls</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
     
    <telerik:RadTextBox ID="RadTextBox1" runat="server" MaxLength="200" TextMode="MultiLine" Width="800px" Height="500px" />
     
    </form>
    </body>
    </html>


    Best wishes,
    Dimo
    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.
  8. Mark Perry
    Mark Perry avatar
    17 posts
    Member since:
    Mar 2010

    Posted 29 Apr 2010 Link to this post

    On the demo page

    http://demos.telerik.com/aspnet-ajax/input/examples/radtextbox/firstlook/defaultcs.aspx 

    If you set Max length to 200 and try copy and pasting in the Multi-Line textbox it works for you?
  9. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 30 Apr 2010 Link to this post

    Hi Mark,

    That's right, it works. Tested with both the latest RadControls version and your version in IE7.

    Sincerely yours,
    Dimo
    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.
  10. Mark Perry
    Mark Perry avatar
    17 posts
    Member since:
    Mar 2010

    Posted 24 May 2010 Link to this post

    We found the issue had to do with a local administrative IE setting set by the internal IT department. Here is how you can replicate the behavior.

    In IE go to  Tools>internet Options> Security Tab.  select the Internet zone and click on Custom Level.  Scroll to near the bottom under the section called scripting.  "Allow Programmatic clipboard access". Select Disable.

    In IE go to http://demos.telerik.com/aspnet-ajax/input/examples/radtextbox/firstlook/defaultcs.aspx

    Set Max Length: 100

    In the Multi-Line: Textbox try to copy and paste some text.

    It doesn't work.

    In a Asp.Net TextBox control we don't have this issue.

    It relates to setting the max length and Multi Line.

     

  11. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 26 May 2010 Link to this post

    Hello Mark,

    In order to support MaxLength for <textarea> elements (which normally do not have such a feature), we use programmatic access to the clipboard during paste operations.

    In your case you can use the following workaround, which will probably be included in the next RadControls version, after some testing. The additional Javascript must be added to the page (or registered in an external JS file) in the <body>, not the <head>.


    <%@ Page Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!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>RadControls</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
     
    <telerik:RadTextBox ID="RadTextBox1" runat="server" MaxLength="3" TextMode="MultiLine" />
     
    <script type="text/javascript">
     
    if (typeof(Telerik) != "undefined" && typeof(Telerik.Web.UI.RadInputControl) != "undefined")
    {
        Telerik.Web.UI.RadInputControl.prototype._onTextBoxPasteHandler = function(e)
        {
            if (this.isMultiLine() && this._maxLength > 0)
            {
                if ($telerik.isSafari) // also Chrome
                {
                    var thisObj = this;
                    window.setTimeout(function() { thisObj._textBoxElement.value = thisObj._textBoxElement.value.substr(0, thisObj._maxLength) }, 1);
                }
                else // IE
                {
                    if (!e) var e = window.event;
                     
                    var clipBoardAccessEnabled = true;
                    try
                    {
                        var clipString = window.clipboardData.getData("Text");
                    }
                    catch(e)
                    {
                        clipBoardAccessEnabled = false;
                    }
                     
                    if (clipBoardAccessEnabled && clipString != "")
                    {
                        if (e.preventDefault) e.preventDefault();
                         
                        var selection = this._textBoxElement.document.selection.createRange();
                        var length = this._maxLength - this._textBoxElement.value.length + selection.text.length;
                        var text = this._escapeNewLineChars(window.clipboardData.getData("Text"), "%0A").substr(0, length);
                        selection.text = text;
                    }
                    else
                    {
                        var thisObj = this;
                        window.setTimeout(function() { thisObj._textBoxElement.value = thisObj._textBoxElement.value.substr(0, thisObj._maxLength) }, 1);
                    }
                }
            }
        }
    }
     
    </script>
     
    </form>
    </body>
    </html>



    All the best,
    Dimo
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017