This is a migrated thread and some comments may be shown as answers.
RadTextBox Cut and Paste IE 7
9 Answers 62 Views
This is a migrated thread and some comments may be shown as answers.
Mark Perry
Top achievements
Rank 1
Mark Perry asked on 01 Apr 2010, 07:48 PM
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>

 

 

 

 

 

 

9 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 Apr 2010, 11:58 AM
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.
0
Mark Perry
Top achievements
Rank 1
answered on 02 Apr 2010, 02:32 PM
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

0
Dimo
Telerik team
answered on 02 Apr 2010, 03:15 PM
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.
0
Mark Perry
Top achievements
Rank 1
answered on 02 Apr 2010, 08:55 PM
2009.3.1314.35
0
Dimo
Telerik team
answered on 05 Apr 2010, 02:06 PM
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.
0
Mark Perry
Top achievements
Rank 1
answered on 29 Apr 2010, 03:15 PM
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?
0
Dimo
Telerik team
answered on 30 Apr 2010, 08:19 AM
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.
0
Mark Perry
Top achievements
Rank 1
answered on 24 May 2010, 03:55 PM

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.

 

0
Dimo
Telerik team
answered on 26 May 2010, 09:18 AM
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.
Tags
Input
Asked by
Mark Perry
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Mark Perry
Top achievements
Rank 1
Share this question
or