SelectionOnFocus="SelectAll" issue urgent.

5 posts, 0 answers
  1. shunman
    shunman avatar
    77 posts
    Member since:
    Jul 2011

    Posted 09 Apr 2012 Link to this post

    Hello  Telerik team.

    I need help aboout we have a TextBox property issue.

    We are using some textbox controls in the RadWindow control.

    I set the SelectionOnFocus="SelectAll" and TextMode="MultiLine" properties on the textbox.

    If close the window as soon as focus on textbox,  it raise telerik script error.

    i'm attaching source code, and screen shot.
    source code link is here: http://www.mediafire.com/?a2aebu7279wggus

    PS. I have tested telerik version "2012.2.406.40" and "2012.1.320.40"
    It still have problem both.

  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 11 Apr 2012 Link to this post

    Hello shunman,

    You could override the _applySelection function like this:

    Telerik.Web.UI.RadInputControl.prototype._applySelection = function()
        {
            if (!this._isInVisibleContainer(this._textBoxElement))
            {
                return;
            }
     
            var control = this;
     
            if ((Sys.Browser.agent == Sys.Browser.Opera) || !document.selection)
            {
                this._textBoxElement.selectionStart = control._selectionStart;
                this._textBoxElement.selectionEnd = control._selectionEnd;
                return;
            }
     
            try
            {
                this._textBoxElement.select();
     
                sel = document.selection.createRange();
                sel.collapse();
                sel.moveStart('character', this._selectionStart);
                sel.collapse();
                sel.moveEnd('character', this._selectionEnd - this._selectionStart);
                sel.select();
            }
            catch (e)
            {
                var context = this;
                window.setTimeout(function ()
                {
     try
            {
                    document.body.focus();
     
                    context._textBoxElement.select();
                    sel = document.selection.createRange();
                    sel.collapse();
                    sel.moveStart('character', context._selectionStart);
                    sel.collapse();
                    sel.moveEnd('character', context._selectionEnd - context._selectionStart);
                    sel.select();
                }catch (e)
            {}
    }, 1);
            }
        }


    Kind regards,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. shunman
    shunman avatar
    77 posts
    Member since:
    Jul 2011

    Posted 11 Apr 2012 Link to this post

    Hello telerik.

    thank you for reply.

    the code is work fine.

    Is there a plan for including this code snippet to next version?
  5. shunman
    shunman avatar
    77 posts
    Member since:
    Jul 2011

    Posted 11 Apr 2012 Link to this post

    Hello.

    I had tried some snippet to some screens.

    I am facing same problem.

    I  include code snippet to each screen's .js file like below.

    function ddd()
    {
    ..........
    }

    Telerik.Web.UI.RadInputControl.prototype._applySelection = function()
    {
    ....................
    }

    a few screens doesn't not overrided function from .js file.
    it still executed by Telerik.Web.UI.WebResource.axd

    could you some advise me for this matter?
  6. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 16 Apr 2012 Link to this post

    Hello shunman,

    Use the OnLoad ClientEvent of the first RadInputControl in your form, to execute your code that overrides the _applySelection. This way you will be sure that the code is always executed and the function get's overridden before it is required.

    A fix will be included in the next version of the controls, but the fix may not be exactly the same as the workaround, we will perform some additional test before and after changing the code.

    All the best,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017