This is a migrated thread and some comments may be shown as answers.

Entry.Value is empty

13 Answers 459 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Vlad
Top achievements
Rank 1
Vlad asked on 01 Aug 2012, 12:25 PM
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

13 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 03 Aug 2012, 07:21 AM
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.
0
Vlad
Top achievements
Rank 1
answered on 03 Aug 2012, 11:00 AM
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.
0
Bozhidar
Telerik team
answered on 07 Aug 2012, 01:48 PM
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.
0
gim.net
Top achievements
Rank 1
answered on 28 Feb 2013, 03:21 PM
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 ""
0
RYNETECH
Top achievements
Rank 1
answered on 09 Dec 2013, 08:58 PM
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.
0
Bozhidar
Telerik team
answered on 10 Dec 2013, 08:07 AM
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.
0
RYNETECH
Top achievements
Rank 1
answered on 12 Dec 2013, 10:02 PM
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.
0
Christophe
Top achievements
Rank 1
answered on 20 Feb 2014, 10:25 AM
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 ?

0
Bozhidar
Telerik team
answered on 21 Feb 2014, 09:30 AM
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.
0
jasper
Top achievements
Rank 1
answered on 19 Aug 2016, 11:39 AM
Too bad. This makes this control unusable for us also in combination with the OnClientEntry... events not being triggered in text mode. 
0
randall
Top achievements
Rank 1
answered on 24 Aug 2016, 06:49 PM

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

0
Robert
Top achievements
Rank 1
answered on 28 Aug 2016, 03:42 PM

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. 

0
Alejandro Genovesi
Top achievements
Rank 2
answered on 12 Sep 2020, 09:26 PM

Hi! any news about this issue?

I agree that the control becomes useless since its impossible to retrieve the value when AllowCustomEntry =true

Thanks

Alejandro

Tags
AutoCompleteBox
Asked by
Vlad
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Vlad
Top achievements
Rank 1
gim.net
Top achievements
Rank 1
RYNETECH
Top achievements
Rank 1
Christophe
Top achievements
Rank 1
jasper
Top achievements
Rank 1
randall
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Alejandro Genovesi
Top achievements
Rank 2
Share this question
or