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

RadTextBox OnBlur

2 Answers 326 Views
Input
This is a migrated thread and some comments may be shown as answers.
Craig Wallace
Top achievements
Rank 1
Craig Wallace asked on 17 Aug 2010, 01:52 PM
Hi,

I am trying to capitalise the text that has been input into a RadTextBox when focus is moved out of the control.

This is my code:
<telerik:RadTextBox ID="txtPostcode" runat="server" MaxLength="8">
<ClientEvents OnBlur="this.set_value(this.get_value().toUpperCase())" />
</telerik:RadTextBox>

This throws an obscure ajax javascript error when the form is first loaded:
Microsoft JScript runtime error: Object doesn't support this property or method.
This is on line 3 at

a(

 

this,b.EventArgs.Empty)

 

of the MicrosoftAjax.js that is generated dynamically by the Telerik.Web.UI assembly. 

Can you tell me what's wrong?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 17 Aug 2010, 02:23 PM
Hello,

Try the following code snippet to achieve the same.

Client code:
<telerik:RadTextBox ID="txtPostcode" runat="server" MaxLength="8">
       <ClientEvents OnBlur="OnBlur" />
  </telerik:RadTextBox>
<script type="text/javascript">
   function OnBlur(sender, args) {
        sender.set_value(sender.get_value().toUpperCase());
    }
</script>


-Shinu.
0
Craig Wallace
Top achievements
Rank 1
answered on 17 Aug 2010, 02:56 PM
Hi Shinu,

That works perfectly, thanks!
Tags
Input
Asked by
Craig Wallace
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Craig Wallace
Top achievements
Rank 1
Share this question
or