3 Questions! Please Respond Urgently!

7 posts, 0 answers
  1. Diana
    Diana avatar
    18 posts
    Member since:
    Nov 2012

    Posted 07 Mar 2013 Link to this post


    I have 3 questions:

    1. I have set the AutoCompleteBox to allow only single mode selection; however, after the user has picked the data I noticed that the control still displays like a linefeed / space as if the user is still allowed to enter more [but it doesn't allow him to enter more than one; I mean it's only adding this space] and I'm not ok with this behaviour. Suggestions? [Pictures attached].

    2. Let's say the page I have saves and displays the details of a certain item; and I use an AutoCompleteBox for the country of origin field. In saving, I won't have a problem since the AutoCompleteBox will display proper data for the user to choose from. But in displaying the saved database records, sometimes the country database field might not have a proper value and still be valid; like "USA" instead of "United States", I want to still be able to view that kind of data in the AutoCompleteBox regardless. Is this possible? How can I do it?

    3. After the user has entered the letters to search for in the AutoCompleteBox, you know there's like a one second delay before displaying the data for him. How can I add like a "loading..." text in the AutoCompleteBox until the data is retrieved for him?

    Many thanks!
  2. Diana
    Diana avatar
    18 posts
    Member since:
    Nov 2012

    Posted 09 Mar 2013 Link to this post

  3. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 11 Mar 2013 Link to this post

    Hello Diana,

    I have tried the first and third scenario. Can you explain a bit more on your second requirement?

    Regarding the first question, The RadAutoCompleteBox displays like a linefeed / space after an item is selected as if the user is still allowed to enter more. That is the default nature even if you are setting the TextSettings SelectionMode to Single. I have a suggestion like once the user picked an item from the RadAutoCompleteBox drop-down, you can change the focus to some other control so that the linefeed is not displayed. Please check the following code.

    <telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" runat="server" EmptyMessage="Enter Name"
        InputType="Text" DataSourceID="SqlDataSource2" OnClientDropDownClosed="OnClientDropDownClosed"
        <TextSettings SelectionMode="Single" />
    <br />
    <telerik:RadTextBox ID="RadTextBox1" runat="server">

    <script type="text/javascript">
        function OnClientDropDownClosed(sender, args) {

    Regarding your third question, If there is some delay in populating the RadAutoCompleteBox drop-down items, you can use Ajax to explicitly display an AjaxLoadingPanel and hide it after the items are  populated. You can attach the OnClientRequesting and OnClientRequested client side events to display an AjaxLoadingPanel. To have a clear idea on explicitly showing and hiding AjaxLoadingPanel, please check this forum thread.

  4. Diana
    Diana avatar
    18 posts
    Member since:
    Nov 2012

    Posted 11 Mar 2013 Link to this post

    Thank you so much Princy. This is very helpful!

    What I meant in the second question; is that I use the AutoCompleteBox to let the user fill the Country field for example. The list of countries is retrieved from a database table and so I know for each entry what is the desired text and value. But, in my case the data is sometimes retrieved from another source; through EDI for example. In this case, I won't have control over the Country values that the user might enter, but I still want to be able to display them. Will "AllowCustomEntry" property solve this problem for me?

    I have one more question, I need to add another attrribute [other than text and value] to each entry of the AutoCompleteBox. I was able to do this using:

    foreach (DataRow row in data.Rows)
                AutoCompleteBoxItemData childNode = new AutoCompleteBoxItemData();
                childNode.Text = row["ContactName"].ToString();
                childNode.Attributes.Add("ContactTitle", row["ContactTitle"].ToString());
                childNode.Attributes.Add("City", row["City"].ToString());
                childNode.Attributes.Add("Country", row["Country"].ToString());
                childNode.Attributes.Add("Phone", row["Phone"].ToString());
                childNode.Attributes.Add("Photo", System.Web.VirtualPathUtility.ToAbsolute("~/Img/Northwind/Customers/" + row["CustomerID"].ToString() + ".jpg"));

    However, I couldn't by any chance get these attributes through JavaScript. I was able to only get and display text and value. This code snippet is taken from the demo here http://demos.telerik.com/aspnet-ajax/autocompletebox/examples/templates/defaultcs.aspx but I don't need a template; I need the same scenario but to use these attributes through JavaScript. Ideas? :)
  5. Bozhidar
    Bozhidar avatar
    1159 posts

    Posted 12 Mar 2013 Link to this post

    Hello Diana,

    Currently RadAutoCompleteBox doesn't provide access to custom attributes on the client, however we will include this functionality in our next Service Pack, or the next official release if we don't have enough time.

    As for your other question: Yes, if you want to allow the user to type any text into the AutoCompleteBox and this text to be saved as an entry, you have to set the AllowCustomEntry property to true.

    Kind regards,
    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. Mohamed
    Mohamed avatar
    7 posts
    Member since:
    Oct 2012

    Posted 14 Apr 2013 Link to this post

    I was asking about the first issue. I've read the workaround and I feel it's a dirty workaround !
  7. chetna
    chetna avatar
    2 posts
    Member since:
    Sep 2016

    Posted 15 Dec 2016 in reply to Diana Link to this post

    I wanted to color the specific attribute at the time of binding . Please help me.


Back to Top