OnBlur event fires when page loads

2 posts, 0 answers
  1. Stephan
    Stephan avatar
    71 posts
    Member since:
    Jul 2007

    Posted 07 Oct 2009 Link to this post

    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.
  2. Tsvetoslav
    Tsvetoslav avatar
    1823 posts

    Posted 09 Oct 2009 Link to this post

    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,
    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.
  3. Telerik UI for ASP.NET Core is out
Back to Top