OnClientEntryAdded Firing Client-Side Before Page is Ready

2 posts, 0 answers
  1. Mike
    Mike avatar
    41 posts
    Member since:
    Aug 2011

    Posted 04 Nov 2014 Link to this post

    I have a form where I'm using an AutoCompleteBox to allow users to select a client from the database and create some information to attach to that client. If the client doesn't already exist, I have a quick input form on the same page that allows them to add the new client to the database. This triggers a server-side event that inserts the client info and returns the Client Name and an automatically generated Client ID that I use to create a token for AutoCompleteBox.

    I'm using the OnClientEntryAdded & OnClientEntryRemoved events to control whether the Add Client form inputs are enabled or disabled. Basically, if a token exists, they cannot add a new client to the database. This works if I load a token through the AutoCompleteBox. The input fields are cleared and disabled when a token is loaded and reenabled if all tokens are removed from the AutoCompleteBox.

    The issues occurs when I fire the server-side click event for the Add Client information. I insert the new record and create a token that I add to the AutoCompleteBox then the OnClientEntryAdded event automatically fires once all the server-side events are complete. The logical operator shown below in my sample script works. It correctly finds that the AutoCompleteBox now has 1 entry but then when it tries to clear and disable the textbox, it throws a null or undefined object error. The best I can determine, is that the OnClientEntryAdded is fired before the textboxes are available in the DOM but I have no idea how to workaround this. Any help is appreciated.

    function NewClientInputsToggle(sender, eventArgs) {
        if ($find("<%= racClientSearch.ClientID %>").get_entries().get_count() == 0) {
            $find("<%= txtNewClient.ClientID %>").enable();
        else {
            $find("<%= txtNewClient.ClientID %>").clear();
            $find("<%= txtNewClient.ClientID %>").disable();
  2. Nencho
    Nencho avatar
    1661 posts

    Posted 07 Nov 2014 Link to this post

    Hello Robert,

    I would like to ask you to provide us with the markup and the declaration of the RadAutoCompleteBox that you use at your end, in order to get a clearer picture on the faced issue and pinpoint the problem. Also, if any additional logic or implementation is needed for the replication of the problem - please provide them also.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top