This is a migrated thread and some comments may be shown as answers.

RadTextbox expand onfocus, shrink onblur

1 Answer 105 Views
Input
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 29 Jul 2010, 05:00 PM
Hello!  I have a RadTextbox and would like it to expand and shrink, whether or not the textbox has focus. 

I've tried below, but am getting strange results. 

<telerik:RadTextBox runat="server" ID="txtNewNote" TextMode="MultiLine" Width="350px" Height="27px" EmptyMessage="Enter new note here..." Skin="Office2007">
    <ClientEvents OnFocus="noteboxFocus" OnBlur="noteboxBlur" />
</telerik:RadTextBox>


function noteboxFocus(sender, eventArgs) {
   var noteTextbox = sender.get_element();
   noteTextbox.style.height = '200px';
   noteTextbox.rows = 10;                 
}
 
function noteboxBlur(sender, eventArgs) {
   var noteTextbox = sender.get_element();
   noteTextbox.style.height = '27px';
   noteTextbox.rows = 1;                   
}


Any advice how I can achieve this functionality?  Thanks so much!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Jul 2010, 12:40 PM
HI Mike,


Try the following code and see whether it helps.


Client code:
<script type="text/javascript">
    function noteboxFocus(sender, eventArgs) {
        var noteTextbox = sender.get_element();
        sender._textBoxElement.style.height = '200px';
    }
    function noteboxBlur(sender, eventArgs) {
        var noteTextbox = sender.get_element();
        sender._textBoxElement.style.height = '27px';
    }
</script>



Thanks,
Princy.
Tags
Input
Asked by
Mike
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Share this question
or