RadTextBox.ClientEvents.OnButtonClick Error

6 posts, 0 answers
  1. Andrew
    Andrew avatar
    104 posts
    Member since:
    May 2008

    Posted 06 Feb 2009 Link to this post

    I get the following javascript error when loading a page where a RadTextBox control exists after setting the RadTextBox.ClientEvents.OnButtonClick property server-side:

    "Object expected."

    And this error only shows up after setting this property like so:

    textBox.ClientEvents.OnButtonClick = "OpenLookupResultsWindow(0, 8)"

    If you view the source the you can see that button associated with the textBox looks like this:

     
    <td class="riBtn"><href="#" onclick="return false;" id="HeaderGridDock_C_HeaderGrid1_radGrid_ctl00_ctl04_HeaderGridTextBox-0-0_GoButton"><span>Button</span></a></td> 

    And the JavaScript generated by Telerik looks like so:

    Sys.Application.add_init(function() { 
        $create(Telerik.Web.UI.RadTextBox, {"_focused":false,"clientStateFieldID":"HeaderGridDock_C_HeaderGrid1_radGrid_ctl00_ctl04_HeaderGridTextBox-8-0_ClientState","enabled":true,"showButton":true,"styles":{HoveredStyle: ["width:97px;""riTextBox riHover"],InvalidStyle: ["width:97px;""riTextBox riError"],DisabledStyle: ["width:97px;""riTextBox riDisabled"],FocusedStyle: ["width:97px;""riTextBox riFocused"],EmptyMessageStyle: ["width:97px;""riTextBox riEmpty"],ReadOnlyStyle: ["width:97px;""riTextBox riRead"],EnabledStyle: ["width:97px;""riTextBox riEnabled"]}}, {"buttonClick":OpenLookupResultsWindow(0,8)}, null, $get("HeaderGridDock_C_HeaderGrid1_radGrid_ctl00_ctl04_HeaderGridTextBox-8-0")); 

    Any ideas why I'm getting this error? I am unable to click the textBox button as a result.

    Thanks,
    Andrew

  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 09 Feb 2009 Link to this post

    Hello Andrew,

    You can specify merely the name of the OnButtonClick client handler of RadTextBox (without passing parameters to it), namely:

    textBox.ClientEvents.OnButtonClick = "OpenLookupResultsWindow";  
     
     
     
     
     

    The two arguments passed in the client event handler are always of the same type - sender (which is the client object of the textbox itself) and eventArgs (depending on the type of the event raised).

    Further information about the client-side events of our RadInput controls can be gathered from this topic.

    Best regards,
    Sebastian
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. muthalagappan muthiah
    muthalagappan muthiah avatar
    5 posts
    Member since:
    Aug 2009

    Posted 21 Aug 2009 Link to this post

    Hi,
    It works with setting the parameters.

    However in my case, I want to pass the parameters (because I want to use other controls value for validation)
    Please help.


    Regards
    Muthu
  4. Dimo
    Admin
    Dimo avatar
    8450 posts

    Posted 21 Aug 2009 Link to this post

    Hello Muthu,

    By design the client event handlers, based on the MS AJAX conventions, do not accept custom parameters. You will need to store and pass the parameter values in some other way, e.g. create a Javascript array on the client, use some hidden fields, etc - it depends on your preferences.

    Kind regards,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. muthalagappan muthiah
    muthalagappan muthiah avatar
    5 posts
    Member since:
    Aug 2009

    Posted 21 Aug 2009 Link to this post

    Thanks for your speedy response.

    Clientarray or hidden values can't work in my case. I have  a set RadDatePicker in a grid.

    I just want to validate the date(comparing with other raddatepicker value and changing the value)
    by calling by fucntion.

    Anyway can i attached a javascript function?

    Plz help

    Regards
    Muthu
  6. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 24 Aug 2009 Link to this post

    Hello muthalagappan,

    You can utilize the client API of RadDatePicker in order to extract the selected date from the active date picker. To compare the value with other date pickers' dates in the grid,  consider the technique to access RadDatePickers in grid templates on the client presented here.

    Best regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top