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

Return DataValueField text

4 Answers 222 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Kurt Kluth
Top achievements
Rank 1
Kurt Kluth asked on 03 Apr 2013, 04:40 PM

Having setup my Autocompletebox properly and returning values, I now need to take the DataValueField and update the database when they click the update button.  However in my code-behind I am unable to reference the selectedvalue. 

<telerik:RadAutoCompleteBox ID="radEmailUser" runat="server"
    DataSourceID="SqlDataSource1"  DataTextField="Contact_Email"
    DataValueField="EmailListID" Filter="StartsWith" InputType="Text"
    Width="300px" DropDownWidth="300px" TextSettings-SelectionMode="Single">
    <DropDownItemTemplate>
    <table><tr><td>
        <%# DataBinder.Eval(Container.DataItem, "contact_Email")%> (
        <%# DataBinder.Eval(Container.DataItem, "first_name")%>  
        <%# DataBinder.Eval(Container.DataItem, "last_name")%>)
        </td></tr></table>
    </DropDownItemTemplate>
</telerik:RadAutoCompleteBox>

I would like to get the value (EmailListID) that is selected and pass that onto a stored procedure for updating.  Unable to properly reference the value.  How can I get the value?

4 Answers, 1 is accepted

Sort by
0
Kurt Kluth
Top achievements
Rank 1
answered on 08 Apr 2013, 01:48 PM
Update on this post:  Didn't use the AutoCompletebox because was too slow and couldn't get the value I was looking for.  Used a RadComboBox instead and it worked in a similar fashion but much faster. 

Thanks
0
Accepted
Nencho
Telerik team
answered on 08 Apr 2013, 02:19 PM
Hello Kurt,

I noticed that you had enabled a Single selection mode of the RadAutoCompleteBox control. Therefor, I would suggest you to access the entry's value in the following manner (in a Button_Click event handler for example): radEmailUser.Entries[0].Value;. Here is video, demonstrating the behavior at my end, implementing the above suggestion.

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.
0
Thomas
Top achievements
Rank 1
answered on 18 Dec 2014, 12:09 AM
So how did you end up getting the DataValueField value?
0
Kurt Kluth
Top achievements
Rank 1
answered on 19 Dec 2014, 02:26 PM
Thomas, 

I don't recall and a search for the control came up empty to provide you a solution that we ended up implementing.  Sorry.
Tags
AutoCompleteBox
Asked by
Kurt Kluth
Top achievements
Rank 1
Answers by
Kurt Kluth
Top achievements
Rank 1
Nencho
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or