Define new function on $find()

2 posts, 1 answers
  1. Jocelyn
    Jocelyn avatar
    148 posts
    Member since:
    Jul 2012

    Posted 29 May 2012 Link to this post

    Hi, I am using Javascript to resize alot of my control.

    I would like to do something like that with a RadTextBox (MultiLine) for example:

    $find("myControl").ResizeInput(width, height);

    So that, I don't have to pass my control in parameter. I want to use "this" instead inside my function. I don't know if I'm clear enough.

    Thanks.
  2. Answer
    Vasil
    Admin
    Vasil avatar
    1633 posts

    Posted 30 May 2012 Link to this post

    Hi Jocelyn,

    To define such function place this just after the script manager on your page:
    <script type="text/javascript" language="javascript">
     
    Telerik.Web.UI.RadInputControl.prototype.ResizeInput = function(width, height)
    {
       this._textBoxElement.style.width = width;
       this._textBoxElement.style.height= height;
    }
     
    </script>

    If you want your function to be only for RadTextBox, use RadTextBox instead of RadInputControl in the code above.

    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.
Back to Top