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

OnBlur event fires when page loads

1 Answer 362 Views
Input
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 07 Oct 2009, 05:53 AM
Hi, I try to use the RadMaskedTextbox, but I run into several issues. Because I use several RadMaskedTextboxes in one user control and this user control is rendered 4 times on my page, I have quit a view of these TextBoxes. But for starters, I try to add a onClientside Blur event. This I do in the codebehind (page_Load event):

 tbxWachttijdEind.ClientEvents.OnBlur = "CalcWachtBlokken('" + tbxWachttijdStart.ClientID + "','" + tbxWerkTijdEind.ClientID + "')"

Oh, BTW, I use these textboxes to have the user only input a valid time between 0 and 23 and 15,30 or45 minutes. This is working perfectly.
So what I try to do is calculate the time difference between two times. The problem is the onblur event does not fire when I leave the textbox, but i fires on page_load. 

An other thing is, I cannot get the values of the controls in my js-code. I tried the get_value() method, but I just get an js-errormessage.

Any suggestions?

Never mind about the get_value issue. I used the $get(objectId) function, where I should use the $find(objectId) function. But the main problem still exists. OnBlur firing when the page load instead of when leaving the textbox.

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 09 Oct 2009, 12:41 PM
Hello Stephan,

The way you are assigning the event handler to the OnBlur event is not the correct one. You need to be assigning a function delegate or just the name of  a client method already present on your page. However, since you are passing additional arguments, the first approach is the valid one for your scenario:

tbxWachttijdEind.ClientEvents.OnBlur = String.Format("function(){return CalcWachtBlokken('{0}','{1}');}", tbxWachttijdStart.ClientID, tbxWerkTijdEind.ClientID);


I hope this helps

All the best,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Input
Asked by
Stephan
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or