Can't set Text with Checkboxes, AllowCustomText and LoadOnDemand true

4 posts, 0 answers
  1. Scott
    Scott avatar
    2 posts
    Member since:
    Apr 2011

    Posted 26 Aug 2011 Link to this post

    What I have set up is a RadComboBox with:

                AllowCustomText = true

                CheckBoxes = true

                EnableLoadOnDemand = true

                OnItemsRequested = MyFunctionToGetColumns
                Text="PreviouslySavedText"

    Everything works as expected, except the input isn't filled with the Text value.
    My workaround for now is to set the EmptyMessage to the PreviouslySavedText.  Is there a better way to set the text on load?


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Aug 2011 Link to this post

    Hello Scott,

    I tried the same scenario and it is working as expected in this version 2011, 1, 315, 35. I suppose this is a version issue. Make sure that you use latest version. Try upgrading to latest version with the help of the following help documentation.
    Upgrading RadControls Trial to RadControls Developer license or newer version.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Scott
    Scott avatar
    2 posts
    Member since:
    Apr 2011

    Posted 29 Aug 2011 Link to this post

    Hi Shinu,
    Thanks for the quick reply.  I'm using version 2011.2.712.35.  Could this have been introduced in the newer version?
    -Scott
  5. Thad
    Thad avatar
    106 posts
    Member since:
    Sep 2010

    Posted 29 Aug 2011 Link to this post

    Hi Scott,

    This is indeed an issue in 2011, Q2.  When using checkboxes, the Text property becomes read-only.  See this post for confirmation:
    http://www.telerik.com/community/forums/aspnet-ajax/combobox/setting-text-via-javascript-when-checkboxes-true.aspx

    Possible workaround.  I noticed that if you bind the RadComboBox using JavaScript, you can set the text property...  Maybe this will help for you? 

    function bindRadComboBoxToJSON(radComboBoxId, jsonData) {
        var comboBox = $find($('.RadComboBox[id$="_' + radComboBoxId + '"]').attr('id'));
     
        if (comboBox) {
            comboBox.trackChanges();
            comboBox.clearItems();
            for (var i = 0; i < jsonData.length; i++) {
                var newItem = new Telerik.Web.UI.RadComboBoxItem();
                newItem.set_text(jsonData[i].text);
                newItem.set_value(jsonData[i].value);
                newItem.set_checked(true);
                comboBox.get_items().add(newItem);
            }
            comboBox.set_text('some default text'); // <---- set text here
            comboBox.commitChanges();
        }
    }

    Please note that the above code reveals another bug.  Adding items that are checked to the RadComboBox  using JavaScript does not automatically set the Text property like it does when binding on the server.  Shouldn't bother you in your situation, but this bug has been reported to Telerik for verification anyway.

    Hopefully they fix this in future releases.
    -Thad
Back to Top