Entry.Value is empty

13 posts, 0 answers
  1. Vlad
    Vlad avatar
    19 posts
    Member since:
    Aug 2012

    Posted 01 Aug 2012 Link to this post

    Hi,

    I am using AutoCompleteBox to help user search various data. Now, the data shown to the user might not exactly correspond to what is written in table field. As I saw that AutoCompleteBoxItemData has Text and Value field, I have filled both accordingly, so that I would know what was their search term.

    Traversing thorugh AutoCompleteBox.Entries however shows, that AutoCompleteBoxEntry has Value property set to string.Empty, no matter what I inserted in AutoCompleteBoxItemData Value property. Wouldn't it be nice to get Value property of an entry as well? Specially when I set it.

    My markup:
    <telerik:RadAutoCompleteBox ID="tbSearch" runat="server" InputType="Text" >
        <WebServiceSettings Method="EventSearch" Path="~/services/SearchService.asmx" />
    </telerik:RadAutoCompleteBox>
    <telerik:RadButton ID="btnSearch" runat="server" Text="<%$ Resources:Global,Search %>" OnClick="btnSearch_Click"></telerik:RadButton><br />

    My code behind:
        Protected Sub btnSearch_Click(ByVal sender As ObjectByVal e As System.EventArgs)
            For Each entry As AutoCompleteBoxEntry In tbSearch.Entries
                Dim strValue As String = Nothing
                strValue = entry.Value   'value = string.Empty
            Next
        End Sub

    Part of web-service that fills the data:
        Private Function GetDataResultFromSearchIndex(ByVal htIndex As HashtableAs AutoCompleteBoxData
            Dim acdataResult As AutoCompleteBoxData = Nothing
            Dim lstitemAutoComplete As List(Of AutoCompleteBoxItemData) = Nothing
            acdataResult = New AutoCompleteBoxData()
            lstitemAutoComplete = New List(Of AutoCompleteBoxItemData)()
            For Each de As DictionaryEntry In htIndex
                Dim itemAutoComplete As AutoCompleteBoxItemData = Nothing
                itemAutoComplete = New AutoCompleteBoxItemData()
                itemAutoComplete.Text = GetKeyValue(de)
                itemAutoComplete.Value = GetResultValue(de)  'value is filled
                Call lstitemAutoComplete.Add(itemAutoComplete)
            Next
            acdataResult.Items = lstitemAutoComplete.ToArray()
            Return acdataResult
        End Function
  2. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 03 Aug 2012 Link to this post

    Hello Vladimir,

    I can't seem to reproduce the issue. I've attached the sample page I used to test the scenario. Could you verify whether the problem occurs on this page.
     
    Regards,
    Bozhidar
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vlad
    Vlad avatar
    19 posts
    Member since:
    Aug 2012

    Posted 03 Aug 2012 Link to this post

    The thing is, you are using InputType="Token". I am using InputType="Text" and with Token the value field is ok. With Text InputType, the value is empty string.

    Thing is though, that field must look like search. And I cannot use tokens.
  5. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 07 Aug 2012 Link to this post

    Hello Vladimir,

    By default when you use InputType="Text" the RadAutoCompleteBox renders just an input field that you can edit freely. Since we cannot keep track of how you edit the text already entered in the AutoCompleteBox, we currently do not support the Value property in this mode.

    However in our latest internal build ( which was released today ) we have introduced a new rendering for the case where you have InputType="Text" and AllowCustomEntry="false" ( renamed from AllowCustomToken, so that in now works with both input types ). With this configuration of RadAutoCompleteBox the Value property is preserved and this issue is resolved.
     
    Kind regards,
    Bozhidar
    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. Eli
    Eli avatar
    4 posts
    Member since:
    Jan 2011

    Posted 28 Feb 2013 Link to this post

    Having similar issue.

    t_value.AllowCustomEntry  = True

    t_value.InputType = Token {0}


    when I debug this I see:
                   ?request("Qry$RBLK$LN_7ec03$t_value")   =     ""

                   ?request("Qry_RBLK_LN_7ec03_t_value_ClientState") =
    "{"enabled":true,"logEntries":[{"Type":1,"Index":0,"Data":{"text":"A. Brooke","value":"A. Brooke"}}],"delimiters":[]}"


    It seem that the text entered (A. Brooke) does show in the data part of the client state. so why are are there no entries and the value is ""
  7. RYNETECH
    RYNETECH avatar
    15 posts
    Member since:
    Feb 2007

    Posted 09 Dec 2013 Link to this post

    Telerik Support,

    Can you tell me if there is a way for the RadAutoComplete to preserve both text and value with the settings InputType="Text" and AllowCustomEntry="True"?

    I am running version 2013.3.1114 with these settings and value is not preserved.  If I set AllowCustomEntry="False" the value is preserved, but then I cannot enter a custom value.
  8. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 10 Dec 2013 Link to this post

    Hello Roger,

    With these settings it's not possible for the RadAutoCompleteBox to preserve the value of an entry.

    Regards,
    Bozhidar
    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.
  9. RYNETECH
    RYNETECH avatar
    15 posts
    Member since:
    Feb 2007

    Posted 12 Dec 2013 Link to this post

    If that is the case, I would like to make a feature request to have AutoComplete preserve the value property even when AllowCustomEntry="True" in an upcoming revision.  It should be possible to provide the value if it comes from the dropdown, and have value be empty if it is a custom entry not in the list.
  10. Christophe
    Christophe avatar
    4 posts
    Member since:
    Mar 2013

    Posted 20 Feb 2014 Link to this post

    Hello,

    I have the same problem, I am using the radAutocomplete in inputmode Text and allow custom entry.
    I should be great if itemData will be keep in this mode and set to empty only for cutoms entries not in the list.

    Did you plan to do it in a further version of Telerik ?
    Is there  a workarround to use itemData in inputMode=Text and AllowCustomEntry=true ?

  11. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 21 Feb 2014 Link to this post

    Hi Chrostophe,

    For the reasons mentioned below we still don't have a solution to store the value property of the AutoCompleteBox items when in Text mode with AllowCustomEntry true, that we find suitable for all scenarios. All solutions we've come up with thus far work only in limited scenarios, and can be easily broken. There is no way to reliably track the entries inside the textbox, when it's just plain text and can be edited freely, in order to preserve any additional information about them.

    Please excuse us for the inconvenience caused.

    Regards,
    Bozhidar
    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. jasper
    jasper avatar
    6 posts
    Member since:
    Oct 2012

    Posted 19 Aug Link to this post

    Too bad. This makes this control unusable for us also in combination with the OnClientEntry... events not being triggered in text mode. 
  13. randall
    randall avatar
    40 posts
    Member since:
    Apr 2009

    Posted 24 Aug Link to this post

    have to agree with Jasper...this control is no-longer usable for us.

    We are using it to enter in email addresses, but also allowing the user to pick from a list already in the system.

    so i have to have AllowCustomEntry =true. however i want the "text" look not the token.

    hope your team finds a solution

  14. Robert
    Robert avatar
    2 posts
    Member since:
    Oct 2015

    Posted 28 Aug Link to this post

    I have run into this issue as well and have been using the following workaround. 

    Using the following settings:

    AllowCustomEntry=true
    InputType=Text
    TextSettings-SelectionMode=Single

    Withing the DropDownItemTemplate I put a javascript onclick event that calls a method to populate hidden fields.

    ASPX:

    1.<DropDownItemTemplate>
    2.    <table onclick="RadAutoCompleteBox_StoreData('<%# DataBinder.Eval(Container.DataItem, "RecordID")%>','<%# DataBinder.Eval(Container.DataItem, "RecordText")%>');">
    3.        <!-- DropDownItemTemplate Text -->
    4.    </table>
    5.</DropDownItemTemplate>

    Javascript:

    function RadAutoCompleteBox_StoreData(value, text) {
        var SelectedText = text;
        var SelectedValue = value;
         
        // populate the hidden fields based on the values sent from the list item
        $("#hf_SelectedText").val(SelectedText);         // store the data text
        $("#hf_SelectedValue").val(SelectedValue);       // store the data value
        $("#hf_ListItemFound").val("1");                 // indicate a list item was found
    }
     
    function RadAutoCompleteBox_TextChanged(sender, eventArgs) {
        // do a quick check to see if a list item was found
        if ($("#hf_ListItemFound").val() == "1") {
            $("#hf_ListItemFound").val("0");                   // reset the list item found
        } else {
            // populate the hidden fields based on the text entered
            $("#hf_SelectedText").val(eventArgs.get_text());   // use the textbox value
            $("#hf_SelectedValue").val("0");                   // set a default value
            $("#hf_ListItemFound").val("0");                   // reset the list item found
        }
    }

     

    When the form is submitted, I just pulled the needed data from the hidden field. I populated the Text in a hidden field to keep it transparent. Typically, I just pull the text from the RadAutoCompleteBox.Text. 

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017