Set readonly RadAutoCompleteBox

22 posts, 0 answers
  1. Charles Goh
    Charles Goh avatar
    13 posts
    Member since:
    Nov 2004

    Posted 08 Mar 2013 Link to this post

    Dear All,
    How can I set RadAutoCompleteBox readonly. I can not find which function support that.
    Thank you very much. 
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 11 Mar 2013 Link to this post

    Hello Charles,

    I am not clear with your requirement. The RadAutoCompleteBox does not have a Read Only property. Suppose if you want to prevent editing the token you can set the AllowTokenEditing property to false. Please have a look at the following mark-up.

    ASPX:
    <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" EmptyMessage="Enter Name"
        InputType="Token" DataSourceID="SqlDataSource2"DataTextField="ContactName">
        <TokensSettings AllowTokenEditing="false" />
    </telerik:RadAutoCompleteBox>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Charles Goh
    Charles Goh avatar
    13 posts
    Member since:
    Nov 2004

    Posted 11 Mar 2013 Link to this post

    Dear Princy,
    I used RadAutoCompleteBox instead of RadTextBox because I want to show my recipients list in token and I don't allow user type in  RadAutoCompleteBox directly. Users have to use other tool to find recipients.
  5. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 13 Mar 2013 Link to this post

    Hi Charles,

    I can suggest you, to disable the RadAutoCompleteBox, since you want to prevent the end user to add, edit or delete entries. You could use the Enabled property set to False.

    Please note that with the usage of the aforementioned property, the appearance of the control would be slightly changed. If you want to persist the standard rendering, I can suggest you to use the property and remove the applied css class (racDisabled) with jquery in the following manner :

    <script>
           function pageLoad() {
               $telerik.$(".racTokenList").removeClass("racDisabled");
           }
       </script>



    Kind regards,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Charles Goh
    Charles Goh avatar
    13 posts
    Member since:
    Nov 2004

    Posted 13 Mar 2013 Link to this post

    Dear Nencho,
    Thank you for support me, It goes perfectly. But I still have one concern, Is it possible to delete token when we set RadAutoCompleteBox's properties to false. As I saw It is impossible.
  7. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 15 Mar 2013 Link to this post

    Hello Charles,

    As you well guessed - it is impossible to delete any token when the suggested approach is implemented. Therefor, I can suggest you a slightly different approach. You could disable only the input area of the RadAutoCompleteBox using jquery and the OnClientLoad  client-side event of the control . Thus you could persist the ability to delete the entries. Consider the following implementation:

    <script type="text/javascript">
     
           function OnClientLoad(sender) {
     
               $telerik.$(".racInput").attr("disabled", "disabled");
           }
     
       </script>



    Greetings,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 21 Jan 2014 Link to this post

    i too am using the Autocomplete box as a token container and do not want users to be able to type in the box and search. It would be nice if disabling the input were done through a property instead of a fragile jQuery call. Also, I might add, the provided solution appears to break the EmptyMessage property of the control.

    Autocompletebox may not be the most suitable control for a token container, but until such time as RadList has a "token" mode it is the only option.
  9. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 24 Jan 2014 Link to this post

    Hello Albert,

    You could use the set_enabled(bool value) client-side method of the RadAutoCompleteBox, in order to manage its Enabled state.


    Regards,
    Nencho
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  10. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 24 Jan 2014 Link to this post

    Like Charles, I don't want the autcompletebox to be disabled. I still want users to be able to remove tokens. I just don't want them to be able to add tokens using the input and search. Tokens are added through a separate process.
  11. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 29 Jan 2014 Link to this post

    Hello Albert,

    I was able to replicate the described issue and it originates from the implementation of the previously provided custom approach.  Therefore, I had forwarded your suggestion about managing the Enabled state only of the input of the control, by a property.

    Regards,
    Nencho
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  12. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 29 Jan 2014 in reply to Nencho Link to this post

    Ok. Here's another suggestion. When the AutoCompleteBox has a fixed width, sometimes the width of a token is wider than the available space. In this case, I don't think there's anything that can or necessarily should be done to display the entire token, however, as it stands, the right-most part of the token is what gets clipped. The problem with this is the rightmost part of the token is where the "X" is, allowing users to remove the token. You need to either move the "X" to the left hand side so it is always visible even if the token is too wide, or provide some sort of scrolling capability in the autocomplete box, or make it so the right hand "X" remains visible even if the token text is clipped in order to fit in the available width. Of the three options, I imagine the first would be the easiest to implement.
  13. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 03 Feb 2014 Link to this post

    Hello Albert,

    Your suggestion is really valuable. I have to inform you, that we had already considered a possible implementation regarding this scenario and the inability of the user to click on the X button, when the Token is wider then the AutoCompleteBox. However, we deiced to implement a slight different approach : restrict the Width of any Token, which is lager then the AutoComplete to have equal width to the Control. In addition, the text which remains invisible will be  replaced by tree dots.

    Regards,
    Nencho
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  14. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 03 Feb 2014 in reply to Nencho Link to this post

    the 2013.3.1114.40 version of your controls doesn't include this functionality, as can be seen from the attached screen capture. Will this be in the next release, or am I missing something?
  15. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 06 Feb 2014 Link to this post

    Hello Albert,

    Your observations are absolutely correct. The feature is not yet implemented. The status of the feature is under implementation and you could use our release history here, in order to track the release of the feature.

    Regards,
    Nencho
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  16. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 06 Feb 2014 in reply to Nencho Link to this post

    How does the release history tell me when I can expect this feature to be implemented?
  17. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 11 Feb 2014 Link to this post

    Hello Albert,

    I would like to clarify that at this moment we are not able to provide you a specific release or a time span when this feature will be implemented. However you can review our road map that contains information about what is coming in the upcoming release or the release history that shows what was fixed and implemented in each release.

    Please do not hesitate to contact us if you have any further questions.

    Regards,
    Boyan Dimitrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
  18. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 02 Sep 2014 in reply to Boyan Dimitrov Link to this post

    I can see that this feature is not yet implemented, 9 months later.. And the roadmap tells me nothing about whether or not an individual feature change in a control will be implemented. As far as I'm concerned, this is a bug since it prevents the proper functioning of the control. If users can't remove a token, then the control doesn't work. Can you give me an indication as to when this bug will be fixed?
  19. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 05 Sep 2014 Link to this post

    Hello Albert,

    Indeed the feature is not yet implemented, this is why I had increased its priority. However, I would like to suggest you a custom implementation, which would fit the requirements of the previously mentioned feature with the three dots at the end of the token, if it exceeds the width of the control. Please find a sample page attached, where a couple of css style rules are used to achieve the needed behavior.

    Regards,
    Nencho
    Telerik
     

    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.

     
  20. Mickael
    Mickael avatar
    57 posts
    Member since:
    Oct 2014

    Posted 15 Sep 2015 in reply to Nencho Link to this post

    Is it possible to have

    $telerik.$(".racTokenList").removeClass("racDisabled"); 

     for a specific RadAutoCompleteBox instead of all of them?

     


     
  21. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 18 Sep 2015 Link to this post

    Hello Mickael,

    Yes, you can achieve the desired functionality by simple modification of the selector, regarding the ID of the RadAutoCompleteBox on which you need to apply the removeClass method:

    $telerik.$("#RadAutoCompleteBox1 .racTokenList").removeClass("racDisabled");

    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  22. Michal
    Michal avatar
    2 posts
    Member since:
    Jun 2008

    Posted 17 Jan in reply to Charles Goh Link to this post

    Hi, I know this is old but could be still usefull, to make it RO use client side OnEntryRemoving function like this:

    function RACB_MyControl_EntryRemoving(sender,args)
    {
    args.set_cancel(true);
    }

     

  23. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 21 Jan Link to this post

    Hello Michal,

    Indeed with the demonstrated approach you will disable the end user from the ability to remove any of the added entries. However, the ability to add new entries still persist. In addition, the visual indication (grey color) will also miss.

    However, thank you for sharing your approach with the community.

    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017