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

resize RadTextBox height with OnFocus event

1 Answer 83 Views
Input
This is a migrated thread and some comments may be shown as answers.
Jeremy Mann
Top achievements
Rank 1
Jeremy Mann asked on 23 Jul 2010, 04:33 PM
With a standard multiline textbox I can add

onFocus='this.style.height=300px' 
onBlur='this.style.height=100px' 


How do I acomplish this with the RadTextBox?

I setup a shared javascript function to handle the resizing of the RTB by passing a paramater, but I can't seem to pass parameters to it. 
function resizeRTB(obj, height, width)
{
obj._originalTextBoxCssText = "width:" + width + "px;height:" + height + "px;"; obj.updateCssClass();
}

If I do something like this, I get JavaScript errors because I'm trying to pass parameters to the function
<telerik:RadTextBox ID="rtbExample" runat="server" TextMode="MultiLine"  Width="550px" Height="150px" EmptyMessage="Example text..."  ClientEvents-OnFocus='resizeRTB(this,300,550);'  ClientEvents-OnBlur='resizeRTB(this,150,550);' />

I need one function to handle a whole set of dynamically created RadTextBoxes, so I need the function to be reusable. Could someone guide or point me to what I'm doing wrong here?

1 Answer, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 27 Jul 2010, 09:32 AM
Hi Jeremy,

In order to make it work you can try to hook the events like this:
protected void Page_Load(object sender, EventArgs e)
{
    rtbExample.Attributes.Add("onfocus", String.Format("resizeRTB($find('{0}'), 300, 550)", RadTextBox1.ClientID));
    rtbExample.Attributes.Add("onblur", String.Format("resizeRTB($find('{0}'), 150, 550)", RadTextBox1.ClientID));
}

Regards,
Pavel
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
Jeremy Mann
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Share this question
or